Hey!
We truly hope that our free tool comes in handy for your business, especially these days. Follow our news, stay safe & pivot on!

Export to PDF using a Header

Answered

this.pivot.exportTo(“pdf”,
{
//header: “<div>##PAGE-NUMBER##</div>”, // CODE Fails when I Uncomment this line
destinationType: “server”,
url: “http://localhost:3658/api/PDF/export”
},
function (response) {
console.log(“Export process is finished”);
});
 
I get the error:
ERROR Error: Uncaught (in promise): Error: Supplied Data is not a valid base64-String jsPDF.convertStringToImageData

3 answers

WebDataRocks Team WebDataRocks March 10, 2020

Hello, Jake,
 
Thank you for reaching out to us.
 
We would like to kindly inform you that our team did not manage to reproduce the described issue.
Please see a CodePen we have created while trying to reproduce the problem.
It would be useful for our investigation if you could modify an example above in the way the mentioned behavior is reproducible.
 
We are looking forward to hearing from you.
 
Kind regards,
WebDataRocks Team

Jake March 11, 2020

Thank you for your answer, i tried your code sample in a regular html file and it does work and exports nicely to pdf.
I forgot to mention I’m using Ionic 4 with the webdatarocks.angular4.ts (I have attached the file) plugin.
It seems just before the error i sent you i get 
DOMException: Failed to set the ‘adoptedStyleSheets’ property on ‘ShadowRoot’: Sharing constructed stylesheets in multiple documents is not allowed
and then i get
 
ERROR Error: Uncaught (in promise): Error: Supplied Data is not a valid base64-String jsPDF.convertStringToImageData
Error: Supplied Data is not a valid base64-String jsPDF.convertStringToImageData
at Object.x.convertStringToImageData (webdatarocks.js:168)

WebDataRocks Team WebDataRocks May 8, 2020

Hi Jake,
 
We’ve done some research and it seems like the adoptedStyleSheets error is linked to the html2canvas library which is used as a part of WebDataRocks pivot table: https://github.com/niklasvh/html2canvas/issues/2058
 
Therefore, unfortunately, there’s not much we can do at the moment other than wait for the fix from the side of html2canvas developers.
 
We hope this helps.
 
Best regards,
WebDataRocks team

Please login or Register to Submit Answer