Closed frankego closed 5 years ago
Hi, is this happening in a platform in particular iOS, Android or both ?
Hi cesar, only on iOS. In androids works well. I've the latest version of Cordova and plugin.
Hi @frankego I think I found the problem, I just pushed the fix for version 2.0.8.
cordova plugin remove cordova-pdf-generator
cordova plugin add cordova-pdf-generator@2.0.8
I think this should solve the problem.
It works!! Thank you for your time and for fast bugfix!!
Hi @cesarvr i have also faced the same issue as like @frankego faced and i have installed 2.0.8 and 2.1.1, now the pdf is generated but without any content on it. it is showing empty pdf files.
I have added screenshot of the PDF file. My case is to create a PDF and send to print. I have used cordova-plugin-printer but it is generating PDF with some CSS alignment issues.
can you please let me know what needs to be done for my issue. I am calling the API like below
"pdf.fromData( document.getElementsByTagName('html')[0].innerHTML, {
documentSize: 'A4',
type: 'share',
fileName: 'myFile.pdf'
})
.then((stats)=> console.log('status', stats) ) // ok..., ok if it was able to handle the file to the OS.
.catch((err)=>console.log(err))"
You need to make sure that the content of document.getElementsByTagName('html')[0].innerHTML
is not empty.
pdf.fromData(
document.getElementsByTagName('html')[0].innerHTML,
{ documentSize: 'A4',
type: 'share',
fileName: 'myFile.pdf'
})
.then((stats)=> console.log('status', stats) ) // ok..., ok if it was able to handle the file to the OS.
.catch((err)=>console.log(err))
Also to debug that the plugin is working currently you can try adding some simple HTML like <h1>Hello World</h1>
as payload for example:
Also you can use this example.
When I use the function that accepts the URL, it works without problems. But when i use htmlToPdf or fromData the promise status is ever in "Pending". With the previous version of the plugin it worked without problems. I tried to debug but I do not get any errors, it simply stays pending.
Do you have any suggestions or can you indicate on some piece of code to investigate? Many thanks!