text is chopped of in pdf report

I have a Spring Boot web application which generates pdf files based on jrxml templates. On certain servers the generated pdfs contains chopped of texts. On other servers the generated pdfs are OK. Everything is contained in the war, there are no external libraries used by the app.

Do you have any idea what can cause this?

This is the OK pdf:

This is the chopped of pdf:

riskop's picture
125
Joined: Feb 4 2007 - 7:15pm
Last seen: 4 months 2 weeks ago

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit https://support.tibco.com/s/ for direct access to our technical support teams offering guaranteed response times.

arai_4 - 4 months 2 weeks ago

2 Answers:

Are you using any custom fonts for the text? If yes can you please check the font type and ensure that the font exists on both servers? Please refer to this KBA for font extension types in Jaspersoft:

https://community.jaspersoft.com/wiki/custom-font-font-extension

JRS-SE's picture
5893
Joined: Oct 30 2017 - 12:56pm
Last seen: 1 hour 20 min ago

No, I am not using custom fonts.

The textual sections in the jrxml file looked like this:

                            <textField>
                                <reportElement x="0" y="0" width="120" height="20" uuid="43249a30-6a76-4c52-b89e-a0a6c6dd68d8"/>
                                <box leftPadding="3" rightPadding="3"/>
                                <textElement textAlignment="Left" verticalAlignment="Middle">
                                    <font pdfFontName="Helvetica" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
                                </textElement>
                                <textFieldExpression><![CDATA[$F{createdDate}]]></textFieldExpression>
                            </textField>

as far as I know

<font pdfFontName="Helvetica" pdfEncoding="Cp1250" isPdfEmbedded="true"/>

means that "Helvetica" font is used which is supplied by the environment (OS) via the JRE. And that is the problem because the OS provides different "Helvetica" fonts on different servers.

If I change that to

<font fontName="DejaVu Sans" fontSize="12" pdfEncoding="Cp1250" isPdfEmbedded="true"/>

then the PDF size grows a bit which I think is the result of *really* embedding the DejaVu font in the pdf. The font looks a little bit different also on the PDF. But I think this is the "bulletproof" way of generating the PDF: the DejaVu font is coming from the  "jasperreports-fonts" artifact which is bundled in the .war file, and the DejaVu font is embedded into the PDF.

I read this doc: 

https://jasperreports.sourceforge.net/sample.reference/fonts/

 

riskop's picture
125
Joined: Feb 4 2007 - 7:15pm
Last seen: 4 months 2 weeks ago
Feedback