Apache OpenOffice (AOO) Bugzilla – Issue 92909
pdf import applies transformation matrix wrongly
Last modified: 2020-11-08 19:23:55 UTC
The Sun PDF Import extension Beta 0.3.1 Solaris x86 on ooo3.0 Beta 2 Build BEB300_m3 produces a rotation when a skew is applied, after that other transformations are somewhat garbled. In the attached file Leers.text.pdf, when viewed in ooo or a pdf viewer, in the top right corner of every page you find a legend with some short text strings, the third line in every legend is a latin species name that should be skewed not rotated, when you open this pdf file in a text editor then line 4980 reads "q 1 0 0.2 1 632 533 cm", q saves the current graphics state, then a transformation is applied. If this file is saved as an ooo drawing and that new file is then unzipped, form a terminal: "unzip Leers.text.odg", then in the file Contents.xml this transformation is translated to "draw:transform="rotate (-0.197396738401708) translate (22.295cm 1.933cm)", this would have been correct had the pdf transformation matrix been "1 -0.2 0.2 1 632 533 cm", it appears that the third component of the matrix is duplicated into the second component of the matrix, however i am not certain that the sign is inversed, it appears to be the case but there is probably more to it than that, the translation in the xml file does also not match the translation in the pdf file (fifth and sixth components of the matrix), when viewed in ooo however the text appears in the correct position. Objects on the same page that appear after this skewed/rotated object in the pdf file are placed in wrong positions, thus it seems the "Q" instruction on line 4987 in the pdf file does not fully restore the graphics state, or at least not the current transformation matrix, this incomplete or incorrect restoration does not always produce the same error in the placement of objects, on different pages in the pdf document the text objects in the legend (upper right) are misplaced in a different manner on different pages. There are other things wrong when this file is imported but those are different bugs. The attached file Leers.txt.pdf is a plain ascii file, so you can open it in any text editor.
Created attachment 55854 [details] example pdf file with transformation errors
Reproducible. Reassigned.
change component.
partially fixed in CWS pdfextfix02; the sample doc graphics now import correct. However I expect further sample documents to come up with different rotations/scalings/shearings, that still go wrong. But at least we have a slight improvement frank_markesteijn: the rotation defined in ODF is in the other direction, which makes the matrix to directly translatable (and causes all kinds of havoc).
please verify in CWS pdfextfix02
set milestone
When will there be a fixed build of the extension available? What about Issue 92908? Isn't it a duplicate of this one?
@norbert2: soon. issue 92908 is not a duplicate however. In fact I made a mistake when setting this one to fixed, what I fixed is the flipped image in issue 92908. Sorry.
Reset assigne to the default "issues@openoffice.apache.org".
PDFImport is not in OpenOffice core but provided as an OXT: https://extensions.openoffice.org/en/project/pdf-import-apache-openoffice So, report any issue directly to the author.