[Reactive Print PDF Button] Manipulate document before rendering- Html2Pdf
Reactive icon
Forge component by Gianluca Bracca
Application Type

Hello Everyone, 

I'm using Html2Pdf library and I'm using the following code to get the doc as binary.

html2pdf().set(opt).from(element).outputPdf().then(function(pdf) {

    //output base64

    $parameters.Base64  = btoa(pdf);

    // output binary

    $parameters.PDF =  $parameters.Base64;



I cannot make the document visible on the screen, it should be invisible and when I click the download button, it will get downloaded.

For that, 

html2pdf().set(opt).from(element).toContainer() .then(function(){

          var doc = $('.html2pdf__container');

          doc.find('.show-on-export').show(); // show content hide by CSS.



This code will help. But I don't want to save the pdf. I just wanted to get the binary of the PDF.

I tried to combine the code, but nothing helps.

Is there any way to manipulate the doc before it converts it into Binary? Or do you've any other solution to suggest for this requirement?

Thanks in advance


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.