How to change the title of de PDFJS previewer

Dear Sir/Madam,

I am trying to change the title of the PDFJS previewer to a user friendly name. At the moment the PDF is loaded by a stream. I do indicate the FileName via Content-Disposition, but for some reason the name of the controller method is constantly shown in the title.

How can I set the previewer title as a custom title?

public ActionResult HandleVB_PdfViewerData()
        {
            Response.AddHeader("Content-Disposition", "inline; filename="+this);
            return FormManager.ProcessInstance.Blob != null ? File(FormManager.ProcessInstance.Blob, "application/pdf"): null;
        }

Hi there,

Thanks for contacting pdf.js express forums,

Does content-disposition: attachment with the file extension (.pdf) make a difference here?

How are you showing the previewer? Is this on pdf.js express pro?

Thanks in advance.

Best regards,
Kevin Kim

Dear Kevin Kim,

If I set the content disposition to attachment, I immediately get a download and the PDF is not shown in the previewer. Incidentally, the download name is correct, but it doesn’t show anything in the previewer.

public ActionResult HandleVB_PdfViewerData()
        {
            var fileName = FormManager.ProcessInstance.Bestandsnaam;
            Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
            return FormManager.ProcessInstance.Blob != null ? File(FormManager.ProcessInstance.Blob, "application/pdf"): null;
        }

Or can I edit the viewer.js to set the title?

I am using pdf.js express.

Thank you in advance!

Kind regards,
Jelle

Hi there,

Thank you for the response,

When you load the document into pdf.js express viewer, can you try setting the fileName attribute as shown here:

Best regards,
Kevin Kim