'How to automatically print instead of download using vue-html2pdf
I am currently using this package to generate a pdf for my component, does anyone have any ideas on how to get it automatically open the print dialog instead of downloading the pdf?
So I was able to get this working by using the hasDownloaded="attemptPrint($event)"
prop on vue-html2pdf.
My attemptPrint function is as below:
attemptPrint(blob) {
let url = URL.createObjectURL(blob);
window.open(url); //opens the pdf in a new tab
}
Solution 1:[1]
So I was able to get this working by using the hasDownloaded="attemptPrint($event)"
prop on vue-html2pdf.
My attemptPrint function is as below:
attemptPrint(blob) {
let url = URL.createObjectURL(blob);
window.open(url); //opens the pdf in a new tab
}
Solution 2:[2]
For this there is a property called: preview-modal, which shows a window with the result of the export.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | oluwatyson |
Solution 2 | pvel36 |