pdf-generator icon indicating copy to clipboard operation
pdf-generator copied to clipboard

Blank PDF file is generated when called first time

Open Ramya-Kakarla opened this issue 4 years ago • 1 comments

Below is the code snippet to generate and save the pdf directly into the file system. Getting the html as shown below. ` var htmlContent = document.getElementById('page-content'); var pdfhtml ='

'+ '
'+ htmlContent.innerHTML + '';

var fileName = file + ".pdf"; var options = { documentSize: 'A4', type: 'base64' }; pdf.fromData(pdfhtml, options) .then(function (base64) { var contentType = "application/pdf"; var folderpath = cordova.file.externalRootDirectory + "Download/"; savebase64AsPDF(folderpath, fileName, base64, contentType); }) .catch(function (e) { console.log(e) });`

It's generating a blank PDF when called the first time. Works fine in the subsequent calls. No errors are shown when the blank file is generated.

Ramya-Kakarla avatar Dec 15 '20 04:12 Ramya-Kakarla

How did you resolve it?

maqeelqureshi avatar Nov 30 '22 11:11 maqeelqureshi