1

I am trying to convert an HTML page to multipage PDF Document. It is a very extensive document containing images, tables and styling.

We are pressing ⌃ Control+P to open the print preview and then saving it as PDF.

Are there any ways we can declare in code that we want to print as PDF and bypass the print preview screen to just download it to the desired location?

1
  • You can't, and I don't see how this functionality will be anything but confusing and unnecessary Commented May 12, 2019 at 19:09

2 Answers 2

2

if there is any ways we can declare in code that we want to print as pdf and bypass the print preview screen and just download it to the desired location ?

No. You can't control what the browser's print functionality will do with the data you give it (it might not even support PDF generation).

I am trying to convert an HTML page to multipage PDF Document

You could generate the PDF using something like jsPDF on the client or some PDF library on the server and trigger a download of the resulting data instead.

Sign up to request clarification or add additional context in comments.

Comments

0

AS @Quentin said, you can't bypass the browser's print window. The only thing you can do is write a function to generate the PDF using something like jsPDF and use your custom keybinding to show a custom window for user to download the PDF. You can refer this article to find out how to bind keys (create shortcut keys in js).

Create Keyboard Shortcuts in JS

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.