Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type: “PDF” does not change the file name: #12

Open
abvas opened this issue May 31, 2020 · 5 comments
Open

Type: “PDF” does not change the file name: #12

abvas opened this issue May 31, 2020 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@abvas
Copy link

abvas commented May 31, 2020

Type: “PDF” does not change the file name:
No matter what is in fileName, the file name is equal to the page title.
Tell me what I'm doing wrong.
Thankyou.

@gharibi
Copy link
Owner

gharibi commented Jun 1, 2020

Hi there. Thanks for using this library. You are doing nothing wrong. This is indeed a bug which affects pdf printable. I will work on it in the coming days and will keep you updated.

@abvas
Copy link
Author

abvas commented Jun 1, 2020

Thank you so much. I will wait for a solution to the problem.

@gharibi
Copy link
Owner

gharibi commented Jun 4, 2020

The printer which actually generates the pdf is fired by the execCommand.print(). In fact it is the browser which fires up the print dialog. Unfortunately from the code we don't have any access to these methods. In some cases object.src=<title> can be used but for our case it won't work as we have a framework.

There is one solution which is not the best and is to change the page title to your file name right before the print job triggers. Afterwards you can set the page title back to what it was.

@mfsbo
Copy link
Contributor

mfsbo commented Apr 3, 2022

Is it worth looking into https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeprint to change title before print and then move it back to what it was after print has happened.

@gharibi
Copy link
Owner

gharibi commented Sep 18, 2022

@mfsbo could you give it a try to resolve this issue with your suggestion?

@gharibi gharibi added the help wanted Extra attention is needed label Sep 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants