Hi, sorry for the 4 months late response :) but priorities are constantly shifting. I did compare the pdf data with PDFDebugger as Tilman suggested and 
the main difference is the way that FOP is positioning the text data. While I do calculate the final positions on my own and set them directly using 
Td, FOP is using the text matrix. I think that these slight differences in the output position is due to that different way of setting the text 
position. In my quest to have identical PDF outputs I found yet another oddity that I'm not able to explain. Both, FOP and PDFBox use the same Font 
(arial.ttf) which I verified with PDFDebugger and pdffonts. For the following test I disabled the font subset so the whole font is included and we get 
the same CIDs for individual letters / glyphs. I output the following text: "22.11.2020". With PDFBox the distance between the two 
"1" glyphs is larger then in the FOP version. With PDFBox and since I support kerning, I output the text with the TJ operator with eventually 
kerning related offsets interleaved. Since none of the character combinations of the string "22.11.2020" has an entry in the kerning table I 
end up with the following output: [ (\000\025) (\000\025) (\000\021) (\000\024) (\000\024) (\000\021) (\000\025) (\000\023) (\000\025) (\000\023) ] TJ 
This totally makes sense to me and is what I expect :) However, when I compare it with the FOP output, I get this (arrows and digits I added): 0 0 Td 
(\000\025) Tj <-- 2 6.672 0 Td (\000\025) Tj <-- 2 6.672 0 Td (\000\021) Tj <-- . 3.324 0 Td (\000\024) Tj <-- 1 5.784 0 Td (\000\024) Tj 
<-- 1 6.672 0 Td (\000\021) Tj <-- . 3.324 0 Td (\000\025) Tj <-- 2 6.672 0 Td (\000\023) Tj <-- 0 6.672 0 Td (\000\025) Tj <-- 2 6.672 
0 Td (\000\023) Tj <-- 0 6.672 0 Td I do understand that FOP is using the Td operator to position the individual glyphs. That's fine. What I don't 
understand is the distance between the first 1 and the second 1. For some reason this distance is smaller (5.784) than the distance after the second 1 
(6.672). I would expect the same distance after each 1. I mean, this explains the difference I see in the output but I don't have a clue what exactly 
could make FOP do that? Could that be some kind of different kind of kerning calculation independent of the actual kerning values? What might be 
related are different FontDescriptor values I found, f.i. FOP reports Ascent as 1005 while PDFBox reports it as 905.27344 .. for the same arial.ttf!? 
o_O I'm aware that these question should be asked at some FOP-Mailinglist but maybe the PDF experts reading this here, have an idea what's going on as 
well? Thank you very much! Jens Jens Hohmuth <[email protected]> schrieb am 22. Juli 2024 um 11:25: Hi, we’re in the process of converting 
our PDF creation from using Apache FOP to Apache PDFBox. To verify, if the output is nearly identical we use Ghostscript to convert the PDF to png and 
then use ImageMagick to compare both png files at the pixel level. In general this works excellent and the expectation is that we generate the same png 
output when everything is using exactly the same settings. However, we do notice some slight differences in the font output between FOP and PDFBox 
which I don’t have an explanation for. It looks like there is some kind of anti aliasing going on in the generated PDF file. These differences are 
displayed as a red outline but for some glyphs there are only partial differences. Please see the attached link with an example image. We output the 
word “Auftragsdetails” with the exact same font and output position and still see these weird partial differences at the outer edges of individual 
glyphs (Please note that the font is rendered regulary and in black color in both cases. The difference is only at the outer edge of the glyphs which 
ImageMagick shows in red). <Bildschirmfoto-2024-07-22-um-10-46-31.png> Bildschirmfoto-2024-07-22-um-10-46-31 hosted at ImgBB ibb.co I was under 
the impression that PDF stores the plain text, the font and possibly transformation information. But the image looks like there are differences in 
individual glyphs. They are slightly bigger in either FOP or PDFBox but not all of them which is weird. Does anyone have any hints or an explanation of 
what this could be? I’m puzzled. Thank you very much for your help and PDFBox in general! Best regards Jens PS: I would understand if the outlines are 
all to the left or the right or top or bottom since this would mean the text rendering position is slightly off but here it’s kinda all over the place.

Reply via email to