Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option to control PDF filenames when users download print results through browser preview

See original GitHub issue

Hello When I try to print a pdf in base64 format the document title does not work.

let opt = {
            "printable": data,
            "type": "pdf",
            "documentTitle": "Test Base64",
            "base64": true

Thanks for sharing this amazing tool.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

crabblycommented, Oct 6, 2020

Got it. That’s what I thought. Currently, the lib won’t use the document title for this. Also, keep in mind that the main purpose for this library is to print. It just happens that users are now trying to download the print results using their browser (the lib doesn’t manage downloads, it dispatch print jobs). Firefox for example doesn’t even show a preview, therefore, if users are going to primarily download the PDFs, I would recommend just giving them a download button on top of the print button.

That said, here is how we print the base64 data:

The lib creates a local blob and url, then it sets the iframe src with that url. If the browser (or OS) gives the user an option to save the print job as PDF, it will use the auto generated id / filename in the url. If we could find a way to control this, we could possibly pass the documentTitle string to it and it may work.

I’ll try to play with this whenever I have a chance. It would be nice if we could add this feature to the lib. A PR is welcomed 😃

yannanna0920commented, Mar 7, 2022

2022年了 这个问题要不要改了

Read more comments on GitHub >

github_iconTop Results From Across the Web

Viewing PDFs and viewing preferences, Adobe Acrobat
Follow these steps to view PDFs in Read or Full Screen mode, set the Full Screen nav bar preference, read a document in...
Read more >
How do I force files to open in the browser instead of ...
Browser tries to open it: use header("Content-Disposition", "inline; filename=myfilename.myextension");. No control over the server code: Use the HTML5 download ...
Read more >
Common file name extensions in Windows - Microsoft Support
Learn what file name extensions are, which extensions are common in Windows, and how to view them in File Explorer.
Read more >
View and modify files and folders in Files on iPad
Modify and rearrange documents. When viewing a file in a supported document format, you can modify and rearrange the document's contents using the...
Read more >
Add Files, Images, Audio, and Video - Blackboard Help
To edit the file's alternative text or display behavior, select the file in the editor and then select the Edit Attachment icon. Insert...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found