Text field content download as pdf

one is text field type and inside this field content download as pdf like after this field add button type filed use click button and download content in [ format

Possible but you have to apply the logic on server and client side.

Please check the documentation.

client script:

frappe.ui.form.on('Test DocType', {
    refresh: function(frm) {
        frm.add_custom_button('Download PDF', function() {
            // The URL to your API endpoint
            const url = `/api/method/your_custom_app.api.download_text_as_pdf?docname=${encodeURIComponent(frm.doc.name)}`;
            window.open(frappe.urllib.get_full_url(url));
        });
    }
});

server script:

import frappe
from frappe.utils.pdf import get_pdf

@frappe.whitelist(allow_guest=True)
def download_text_as_pdf(docname):
    doc = frappe.get_doc('Test DocType', docname)

    html_content = f"<div><p>{doc.text_editor_field}</p></div>"

    pdf_data = get_pdf(html_content)

    frappe.local.response.filename = f"{doc.name}.pdf"
    frappe.local.response.filecontent = pdf_data
    frappe.local.response.type = 'download'

Please set your method and field name in the script according to the scenario.

Output: