PDF Download File Name Showing “pdf.pdf”

Hello Everyone,

Previously, whenever we downloaded PDFs from Sales Invoice, Quotation, Sales Order, Delivery Note, etc., the downloaded file name was automatically generated like:

“Tax Invoice - 8077 - TWIN ADVERTISING LLC.pdf”

But after updating Manager.io, all downloaded files are now saving only as:

“pdf.pdf”

We are using a custom Liquid theme.

Can anyone please guide how to restore the previous dynamic PDF file naming format in the latest Manager.io version?

Requirement:
Document Type - Invoice Number - Customer Name.pdf

Example:
Tax Invoice - 8077 - TWIN ADVERTISING LLC.pdf

If possible, kindly share the exact working code as well.

Thank you.

Filename will be whatever is in your <title></title> block. Previously filename has been hard-coded into the program. The latest version makes it possible to customize.

If you are using custom theme, then you need to customize it too. Or just create new custom theme from scratch using javascript (not liquid markup)

I’m not an IT guy, I tried it using ChatGPT and Gemini. Could you please send me a preset code with only my requirements? as I am unable to solve it.

Start new theme using the stub as shown here:

I am having isssue In tile name of pdf .Cloud version
it was previously showing customer name and sales invoice number in the pdf file name

Confirming the issue, Cloud Version.

Same issue here. Cloud version.

Cloud version 26.5.13.3590
PDF files are downloaded with the right file names, I am not facing the issue

same issue here on cloud version.

Dear Lubos,

Can you please share code for pdf file title change.

@asvinalbert I can’t because this is affecting only users using custom themes and every custom theme is unique. What has changed is that previously filename was hardcoded into the program. New approach is that filename is configurable by theme (whatever is in <title></title> tag).

You can copy and paste your current theme into AI, tell it exactly what I wrote now and it will figure it out what needs to be improved in your custom theme.

Thanks Lubos. Working fine now

After updating to the latest version, the PDF button is no longer naming the file like it used to.
It has always automatically named the file starting with “Invoice” and the invoice #, followed by the customer name.
Now it simply wants to name the file PDF.PDF
Please see the screenshot included

Am I doing something wrong? If not, can this please be corrected ASAP?

After upgrading, HTML was not working with the standard sales invoice.
I changed to use the theme “Bold Blue” and now the it wants to name my PDFs pdf.pdf.

I’m not an IT person and can’t find where/what to change in the coding for “Bold Blue” to correctly name the pdf files.

Can you please help?

I also have no idea about anything to do with AI or chatgtp as I’ve never used these

Can you please share what you did?

Where is <title></title> tag)?
I’ve looked in the code for the “bold Blue” theme and can’t find that anywhere!

And, what do I replace <title></title> tag) with to have the pdf file named - invoice number and customer name?

bugs

I can confirm on this matter. Quite some functionality (also invoicing by email) isn’t working as before since the change in raw HTML/Liquid.

Second bug that isn’t fix since: Email template variables not working - bugs - Manager Forum

What tag is for title for invoice number

This is what I’ve inserted in my custom theme:
First, starting from the top of your Custom Template, make sure there is:

<head>
	<meta charset="UTF-8" />
	<title>Invoice</title>
	...

Second, these two functions within the SCRIPT-tag:

        function SafeFilePart(value) {
            return (value === null || value === undefined ? "" : String(value))
                .replace(/\[\\\\/:\*?"<>|\]+/g, "-")
                .replace(/\[\\u0000-\\u001f\\u007f\]+/g, "")
                .replace(/\\s+/g, " ")
                .replace(/^-+|-+$/g, "")
                .trim();
        }
        function GetFieldText(data, key, label) {
            const fields = Array.isArray(data && data.fields) ? data.fields : \[\];
            const wantedKey = (key === null || key === undefined ? "" : String(key)).toLowerCase();
            const wantedLabel = (label === null || label === undefined ? "" : String(label)).toLowerCase();
            const found = fields.find(f => {
                const fk = (f && f.key !== null && f.key !== undefined ? String(f.key) : "").toLowerCase();
                const fl = (f && f.label !== null && f.label !== undefined ? String(f.label) : "").toLowerCase();
                return (wantedKey && fk === wantedKey) || (wantedLabel && fl === wantedLabel);
            });
            return found && found.text !== null && found.text !== undefined ? String(found.text).trim() : "";
        }

Third, I’ve added this code in the SCRIPT-tag:

            // Set browser/PDF-title. Manager/browser uses this as the PDF filename.
            const invoiceNumberForTitle = GetFieldText(data, "InvoiceNumber")
                || GetFieldText(data, "Invoice Number", "Invoice Number")
                || data.reference
                || "";
            const customerNameForTitle = (data.recipient && (data.recipient.name || data.recipient.code)) || "";
            document.title = \["Invoice", invoiceNumberForTitle, customerNameForTitle\].map(SafeFilePart).filter(Boolean).join(" - ");

Hope, that will help or guide you.

Cheers,
Canefield

Thanks mate God bless you