Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank PDF file is generated when called first time #131

Open
Ramya-Kakarla opened this issue Dec 15, 2020 · 1 comment
Open

Blank PDF file is generated when called first time #131

Ramya-Kakarla opened this issue Dec 15, 2020 · 1 comment

Comments

@Ramya-Kakarla
Copy link

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.

@maqeelqureshi
Copy link

How did you resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants