Need a special offer?Find out if your project fits.
+

I get an weird error on export

Answered
Cedric Gaines asked on April 7, 2020

Sometimes when I export pdf or image i get this error...

Error: Supplied Data is not a valid base64-String jsPDF.convertStringToImageData at Object.x.convertStringToImageData (jspdf.min.js?2.8.2:23) at Object.x.addImage (jspdf.min.js?2.8.2:23) at Function.v3l.nN (flexmonster.js:9) at Function.v3l.cG (flexmonster.js:9) at Function.v3l.cR (flexmonster.js:9) at flexmonster.js:9 at flexmonster.js:9

 
 
What would cause this.  should i be doing something when I export this out.  I overrode the export functionality when I export excel, image or pdf.
 
here is my code...
 

function exportPDF(whichTab) {
var currentTitle = document.getElementById('customLabel').value;
switch (whichTab) {
case "Person":
{
personFlex.exportTo('pdf', {
header: currentTitle
});
} break;
case "Crash":
{
crashFlex.exportTo('pdf', {
header: currentTitle
});
} break;
case "Vehicle":
{
vehicleFlex.exportTo('pdf', {
header: currentTitle
});
} break;
default:
{
//do nothing
} break;
}
}
function exportImage(whichTab) {
var currentTitle = document.getElementById('customLabel').value;
switch (whichTab) {
case "Person":
{
personFlex.exportTo('image', {
header: currentTitle
});
} break;
case "Crash":
{
crashFlex.exportTo('image', {
header: currentTitle
});
} break;
case "Vehicle":
{
vehicleFlex.exportTo('image', {
header: currentTitle
});
} break;
default:
{
//do nothing
} break;
}
}
function exportExcel(whichTab) {
var currentTitle = document.getElementById('customLabel').value;
switch (whichTab) {
case "Person":
{
personFlex.exportTo('excel', {
header: currentTitle
});
} break;
case "Crash":
{
crashFlex.exportTo('excel', {
header: currentTitle
});
} break;
case "Vehicle":
{
vehicleFlex.exportTo('excel', {
header: currentTitle
});
} break;
default:
{
//do nothing
} break;
}
}

Start your code here

 

 
 
 

 

 
 

2 answers

Public
Cedric Gaines April 7, 2020

also, 
for custome headers, Can i use a HTML string for custom Image and PDF headers?

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster April 8, 2020

Hello, Cedric,
 
Thank you for contacting us.
 
Our team would like to kindly inform you that we did not manage to reproduce the problem on our side. It would be useful for our research if you could provide us with a JSFiddle where the issue would be reproducible.
 
We would like to kindly draw your attention to the fact that the value of the header property should be a string type.
 
For PDF and image export, the header can also be set using the HTML format (tags, inline styles, img with base64 src).
 
Please check out the page from our documentation dedicated to export and print in order to get detailed information.
 
We hope it helps.
Our team is looking forward to hearing from you.
 
Kind regards,
Illia

Please login or Register to Submit Answer