question-mark
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.

Open pdf in new tab

See original GitHub issue

How can I open pdf in new tab? Now I can only save pdf in file: html2pdf($("#template #template_invoice")[0],{ margin: [0,0,1,0], image: { type: 'jpeg', quality: 0.98 }, html2canvas: { dpi: 192, letterRendering: true }, jsPDF: { unit: 'in', format: 'a4', orientation: 'P' } });

Thanks for help.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

38reactions
eKoopmanscommented, Feb 24, 2018

Hi, I have just pushed a new branch, new-api, which is ready for testing! The readme has all the information on the new API. Please let me know if there are any problems with it - I want to make sure it’s stable before merging into master!

For this specific request (similar to #29), you could load the PDF in a new tab like so:

html2pdf().from(element).toPdf().get('pdf').then(function (pdf) {
  window.open(pdf.output('bloburl'), '_blank');
});
3reactions
cedlinxcommented, Aug 11, 2021

Hi, I have just pushed a new branch, new-api, which is ready for testing! The readme has all the information on the new API. Please let me know if there are any problems with it - I want to make sure it’s stable before merging into master! For this specific request (similar to #29), you could load the PDF in a new tab like so:

html2pdf().from(element).toPdf().get('pdf').then(function (pdf) {
  window.open(pdf.output('bloburl'), '_blank');
});

Opening in the new tab, but not with the data for me.

Worked perfectly for me at first try… be sure you are feeding it the right data. Or Can we see your code?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Opening a new tab to read a PDF file - Stack Overflow
There is no way to force a user's browser to open a PDF file in a new tab. Depending on the user's browser...
Read more >
Ensuring PDF hyperlinks open in a new tab or windo...
Ensuring PDF hyperlinks open in a new tab or window in ALL browsers · Access the Link tool (Tools > Advanced Editing >...
Read more >
How to enable Chrome PDF viewer to open as a new tab?
1) Install this PDF viewer extension in Chrome: · 2) In the extension options, enable "Allow access to file URLs" · 3) Chrome...
Read more >
How Do I Stop My PDF Documents From Opening in a New ...
Procedure: · Open Windows Settings · Click on Apps · Click on Default apps · Click the Choose default apps by file type...
Read more >
How to always open PDF files in new tab? (with built ... - Reddit
Might try going to Tools -> Settings -> General and under the applications tab, set PDFs to Always Ask. Then, when the dialog...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found