It's about overlapped text problem when creating new pdf file with org.apache.pdfbox from java code, problem don't know how to fix on win7 workstation:

  1. Pdf file model:

" Melléklet a szállítólevélhez: x x x

Dátum: x x x

"

  1. Creating new pdf file replacing "x x x " with java code :

"

Melléklet a szállítólevélhez: 26201738

Dátum: 2019-05 -02 14:49:00

"

Except that "26201738" is displayed overlapped (can not put imaged here) also "2019-05 -02 14:49:00". The maximum length with overlapped characters are maximum 4 respectively 8.

On 2 different workstation with win7 with the same java_update version and the same workspace eclipse with the same eclipse and same java code, it is creating the pdf file with NO overlapping text.

I have tryed with the same Fonts copied to the bad workstation-negative result. Tryed to swich "Region and language" to Germany exactly the other station-no result. Tryed to update to Acrobat Reader DC-no result. It seems that workstation OS is missing something when creating new PDF with org.apache.pdfbox and can't figure it out what is it? It is excluded the java code problem since 2 other stations is working correctly in generating new PDF file.

Best regards, Laurentiu

2

There are 2 best solutions below

0
Laurentiu Alexandru On

Problem solved! It seems the pdf model which need to replace "x x x " and create a new one from him had something wrong inside. I have replaced PDF file model with a good file and everything is working now. Thank you and best regards!

0
Tilman Hausherr On

Your source PDF has zero widths for "2", "3", "7" and "9". This can be seen by looking at Root/Pages/Kids/[0]/Resources/Font/F1/Widths with PDFDebugger. Root/Pages/Kids/[0]/Resources/Font/F1/FirstChar is 32, so "0" (code 48) can be found at position 16. Whoever/Whatever created the original PDF only set the width for the characters used. That is yet another of the many pitfalls with replacing text in existing PDFs, which is why the example was removed.

Instead of using "x x x", I'd recommend to use an acroform field or to put the date / client# at a predefined position.