red6 / pdfcompare

A simple Java library to compare two PDF files
Apache License 2.0
220 stars 66 forks source link

Using fallback font LiberationSans for Helvetica #146

Closed marwin1991 closed 3 hours ago

marwin1991 commented 3 hours ago

Hello, how can I solve problem:

o.a.pdfbox.pdmodel.font.PDType1Font      : Using fallback font LiberationSans for Helvetica

I load font's for jasperreports like this:

        JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.extension.simple.font.families.ireportfamily", "fonts/fonts.xml");
finsterwalder commented 3 hours ago

Honestly, I have no idea. This is a PdfBox level issue. I don't know the details of how PdfBox manages Fonts and where it get's Fonts from. Maybe you just need to make sure that the Helvetica font is available on the machine executing the compare? Otherwise I advise you to research on PdfBox Font handling. Nothing I can help with, really.

finsterwalder commented 3 hours ago

How you load fonts in Jasper Reports is totally unrelated. The only thing that is relevant is, which fonts are in the PDF. BTW: PDF Compare will load both documents with the replacement Font, so the comparison should ideally still be valid, even though the docs might not look exactly how you want them. And one more thought: Maybe you can tell Jasper Report to embed the font into the PDF. Would make the Pdf bigger, but independent.