Charts export to pdf (special characters)

I’m exporting Vaadin charts analogous as described here:

https://github.com/vaadin/charts/tree/master/chart-export-demo


https://github.com/vaadin/charts/blob/master/chart-export-demo/src/main/java/com/vaadin/demo/chartexport/util/PdfExportDemo.java

Chart > to svg with SVGGenerator > to Image via Batik > itext.

However, I have some special characters in the StackLabels/Chart caption (eg €, -,…) which are not displayed correctly in the resulting pdf. Where can I set the correct encoding?

Hi,

Try specifying the correct encoding when creating the iText font by using one of the getFont methods that accepts encoding as the second parameter. See the java doc here:
http://api.itextpdf.com/itext/com/itextpdf/text/FontFactory.html

HTH,
/Jonatan

Hi Jonathan,

thanks fo the input! I suspect the problem is not iText but the SVGGenerator? I only have problems with certain special characters in the chart. For example, if the chart title contains
\u20AC € @&%
the resulting String from
String svg = SVGGenerator.getInstance().generate(conf)
is
� � @&%.

So only the € seems to make a problem…Any ideas?

17250.pdf (28.4 KB)

also suboptimal is that the exporting menu is exported also to the svg image. is there a way to change that?
17266.png

created a ticket…
http://dev.vaadin.com/ticket/15315

Hello all,

I have the same problem when generating svg from Chart using SVGGenerator. All German Umlaute like ü, ä or ö are converted to the same 3 bytes 0xEF, 0xBF, 0xBD which are displayed as �. This seems to be a general problem of the SVGGenerator.

Is there any solution for this?

Thanks for your help
Rolf

Hi,

There has been some issues with special characters and SVGGenerator like
#18992
in the past, but afaik they’re solved and released.

What version of Vaadin Charts are you using? On what plaftorm is it failing?

Regards,

Guille

Hi Guille,

I used Charts 2.0. After updating to Charts 3.0 the problem was fixed. But then rotated labels on the x-axis where NOT rotated in the chart but in the exported pdf. This seems to be a bug in 3.0. I then changed to Charts 2.1.3 and now everything is working fine.

Thanks for your help
Rolf

I’m glad you found a solution!

Regarding the charts 3 issue with rotated labels can you create a ticket in
https://dev.vaadin.com/
with the details to reproduce it?

Sorry, that was my fault. I forgot to compile the widgetset. Now charts 3 is working fine…