0

I try since few days to produce a new pdf file with pdfbox from a data extraction which contains values with different fonts. I have mainly latin characters but some names in my list of strings are in chinese or cyrillic, etc, characters.

I have spent lots of time and energy on google or stackoverflow but still don t manage to produce it(glyphe issue). Currently, I m on Windows but will be deployed on Linux, and I use the version 2.0.26 or 3.0.0-RC1 of pdfbox.

I m manage to load ttf like that:

PDType0Font.load(doc, File("src/main/resources/font/LiberationSans-Regular.ttf").inputStream(),false)

if I set true to embedded in any cases, I got an issue of cmap.

I also tried to load ttc files but failed each time.

I have already started to implement this solution link but I don t manage to init/load correctly my font

Do you have any idea to do it?

Best, Mat

ferlaymat
  • 11
  • 3
  • Please explain what issues you have with implementing the solution from the solution you linked. Because that in principle is a working solution... – mkl Jul 04 '22 at 14:31
  • The `EmbeddedMultipleFonts.java` shows how to this can be done. Re "I set true to embedded in any cases, I got an issue of cmap", then tell which font does this. (if you're using maven, make sure to disable filtering on font resources!) – Tilman Hausherr Jul 04 '22 at 17:09
  • Hi @TilmanHausherr, I think you put the finger on it. I manage to reuse the code done by mkl but style have the issue about cmap. I ll try to do what you said but not sure to know how to do it – ferlaymat Jul 05 '22 at 06:20
  • https://stackoverflow.com/questions/16828161/ this one mentions resource filtering. Try also loading the font from a file. If it still doesn't work, then resource filtering isn't the cause, then use a different font. – Tilman Hausherr Jul 05 '22 at 06:35
  • @TilmanHausherr was not that but I manage to solve my problem by cleaning some characters manually. The most are automatically managed – ferlaymat Jul 05 '22 at 07:37

0 Answers0