ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Cannot update pdf file title in get_pdf() options

Hello all,
Am trying to upload pdf to a remote server and that server is picking filename from title, so trying to customize pdf filename and title . On saving pdf filename is working fine but for some reason get_pdf() title option is not working as expected.

@frappe.whitelist(allow_guest=True)
def download_pdf_for_guest(doctype, name, format=None, doc=None, no_letterhead=0, file_name=None):
	from frappe.utils.pdf import get_pdf
	
	file_name = file_name.replace(" ", "-").replace("/", "-")

	html = frappe.get_print(doctype, name, format, doc=doc, no_letterhead=no_letterhead)
	frappe.local.response.filename = "{file_name}.pdf".format(file_name=file_name)
	frappe.local.response.filecontent = get_pdf(html, {"title": file_name})
	frappe.local.response.type = "pdf"

In reference to example on this link: