Gantt export to PDF/PNG. CSS styles are not getting applied


#1

Hi

Could you please help me to figure out why my custom URL file is not getting applied

It is served from our CDN - https://cdn.aws.freedcamp.com/platform/css/print.css

I use it as described in the manual

var gantt_export_css_url = "https://cdn.aws.freedcamp.com/platform/css/print.css";

headerString = '<link rel="stylesheet" href="'+gantt_export_css_url+'">';

gantt.exportToPDF({name: filename + ".pdf", header: headerString});

If I use ngrok and replace URL with CSS link pointing to my development machine - all works perfectly.

Thanks for the help.

Rostyslav


#2

Hello Rostyslav,
It might happen because of various reasons. Unfortunately, I don’t have an online CSS that I can edit. In my opinion, the best way is to include background: 'your colour'" to detect that the style is applied. I would suggest that it might happen because of @media print { string at the beginning of the file, as it is not applied on the web page, but it is applied in the exported file:
http://snippet.dhtmlx.com/6f72b6490
Please try reproducing the issue in the snippet above, after that click on the “share” button and send me the link. I will try to reproduce it locally and find what might be wrong.

Best Regards,


#3

Ramil, Thanks for the answer.
I added background: green; to the file and prepared https://snippet.dhtmlx.com/deb9adc25 as you asked.

Just my thoughts.
Probably you can’t get my file on your backend when preparing pdf.


#4

Hello,
Thank you. The export server needs to access the CSS file, that’s why including local files may not work.
But using your file, I was able to find a bug. Looks like, everything works correctly if you use the standalone module, but it doesn’t work if you use the online export server.
I added that bug in the tracker and it will be fixed in the future.


#5

We have a commercial license. Could you please provide us with local export library until this bug is fixed.


#6

Hello,
Please, contact the support team to discuss that question and mention this topic.