Mahesh Mohan
Posts: 10
Joined: Wed Apr 27, 2022 4:06 am

Offline-exporting as PDF with allowHTML true not working

Hi, I am using Highcharts Gantt in my ReactJs project, we need to implement offline pdf exporting in this. Since we have html content in datalabel, we have to use allowHTML as true. When we are using allowHTML true and fallbackToExportServer: false getting an error
Error: Highcharts error #28

This is my code for exporting.
exporting: {
fallbackToExportServer:false,

menuItemDefinitions:{
downloadPNG:{
text:"Export as PNG"
},
downloadSVG:{
text:"Export as SVG"
},
downloadPDF:{
text:"Export as PDF",

},
downloadJPEG:{
text:"Export as JPEG"
}
},
allowHTML:true,
buttons: {
contextButton: {
menuItems: ['downloadPNG', 'downloadSVG', 'downloadPDF','downloadJPEG'],
symbol: 'download',
symbolStroke: "white",
theme: {
fill:"#2D354D",
states: {
hover: {
fill: "#2D354D"
},
select:{
fill:"#2D354D"
}
}
},

}
}
},


Do we have a solution for this or do we have any other way to export chart offline as pdf. Thank you in advance
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Offline-exporting as PDF with allowHTML true not working

Hi Mahesh Mohan!
Thanks for contacting us with your question!

It seems, that my colleague has recently answered the same question, as yours. You can the topic here: viewtopic.php?f=9&t=49385

Let me know if you have any further questions.
Regards!
Hubert Kozik
Highcharts Developer
Mahesh Mohan
Posts: 10
Joined: Wed Apr 27, 2022 4:06 am

Re: Offline-exporting as PDF with allowHTML true not working

Hi Hubert,

I checked the link that you provided, there also offline exporting as PDF not working, Only for PNG, JPEG, SVG is working, I am using highcharts with versions 10.0.0.
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Offline-exporting as PDF with allowHTML true not working

Mahesh Mohan,
I have reproduced offline-exporting using Highcharts v.10.0.0 and everything seems to work correctly: https://jsfiddle.net/BlackLabel/5xcbmfz4/

Could you reproduce the issue in an online editor that I could work on?
Regards!
Hubert Kozik
Highcharts Developer
Mahesh Mohan
Posts: 10
Joined: Wed Apr 27, 2022 4:06 am

Re: Offline-exporting as PDF with allowHTML true not working

Hubert,

I have gone through the jsFiddle you shared, I am using fallbackToExportServer : false with allowHTML:true like mentioned below. Then export to PDF doesn't work.

exporting: {
allowHTML: true,
fallbackToExportServer:false,
},
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Offline-exporting as PDF with allowHTML true not working

Mahesh Mohan,
Yes, if you set these properties like you, you will probably also get error #28 in your console, which means:
Fallback to export server disabled
This happens when the offline export module encounters a chart that it can't export successfully, and the fallback to the online export server is disabled. The offline exporting module will fail for certain browsers, and certain features (e.g. exporting.allowHTML ), depending on the type of image exporting to. For a compatibility overview, see Client Side Export.

For very complex charts, it's possible that exporting fail in browsers that don't support Blob objects, due to data URL length limits. It's always recommended to define the exporting.error callback when disabling the fallback, so that details can be provided to the end-user if offline export isn't working for them.
(https://assets.highcharts.com/errors/28/)
Demo: https://jsfiddle.net/BlackLabel/dwjLa1hs/

That means: exporting.allowHTML feature doesn't work with the offline exporting module - it means that it was impossible to implement it and, unfortunately, there is no way to export HTML elements using offline exporting.

If you want to add some elements to your chart, I suggest rendering them using Highcharts SVG Renderer.

Best regards!
Hubert Kozik
Highcharts Developer
Mahesh Mohan
Posts: 10
Joined: Wed Apr 27, 2022 4:06 am

Re: Offline-exporting as PDF with allowHTML true not working

Hubert,

Thank you for your suggestion.
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: Offline-exporting as PDF with allowHTML true not working

You're welcome! In case of any further questions, feel free to contact us again.
Hubert Kozik
Highcharts Developer

Return to “Highcharts Gantt”