You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Michael Klink (Jira)" <ji...@apache.org> on 2020/06/17 15:09:00 UTC

[jira] [Commented] (PDFBOX-4889) Cannot flatten this file.

    [ https://issues.apache.org/jira/browse/PDFBOX-4889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17138541#comment-17138541 ] 

Michael Klink commented on PDFBOX-4889:
---------------------------------------

The *AcroForm* form structure of the PDF is utterly broken. But that's not the problem here.

The problem is that some of the widget annotations referenced from the document page have a non-empty *Rect* but a normal appearance with an empty (0×0) *BBox*. When displaying or flattening that widget, the *BBox* area of that appearance must be moved and scaled to fill the widget *Rect*. But that is impossible, you cannot scale a zero width or height by a finite real number to fill a none-zero width or height. Unfortunately PDFBox does not check for this situation and tries to scale by infinity. This in turn eventually is caught by some later concatenation of the scaling with another transformation, resulting in the observed exception.

As an example the field with the partial name "topmostSubform[0].Page1[0].f1_1[0]" (which is an invalid _partial_ name) has a *Rect* {{[ 36 684 467.25 698.001 ]}} and its normal appearance has a *BBox* {{[0 0 0 0]}}.

Strictly speaking this PDF is broken. But a more benign behavior of PDFBox would be to recognize the broken appearance and ignore it.

I'm not sure whether a new annotation should be built and flattened instead or whether the field should be completely ignored. In the case at hand the result would be identical because (at first glance) the fields with these invalid empty normal appearances also have no value.

> Cannot flatten this file.
> -------------------------
>
>                 Key: PDFBOX-4889
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4889
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.20
>            Reporter: Jief Knudsen
>            Priority: Major
>         Attachments: f1040sb test.pdf
>
>
> Calling pdfDoc.getDocumentCatalog().getAcroForm().flatten() gives 
> "Multiplying two matrices produces illegal values"
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org