Jump to content
We've recently updated our Privacy Statement, available here ×

text is chopped of in pdf report


riskop

Recommended Posts

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:

pdf_ok_screenshot.png.23d7086589b43adf32dd7ea864477201.png

This is the chopped of pdf:

pdf_chopped_screenshot.png.41fd367e2459077412c0d78c452b32fc.png

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

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/

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...