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

Tilman Hausherr edited comment on PDFBOX-4812 at 4/14/20, 12:51 PM:
--------------------------------------------------------------------

GIGO. The content stream of the appearance stream of the annotation widget of 
that field is:
{noformat}
q 1.0 1.0 1.0 rg 0 0 496.4 500.2 re f Q /Tx BMC q 0.0 0.0 496.4 500.2 re W n  
BT 0.0 0.0 0.0 rg 1.0 491.9 Td /F0 9.0 Tf 
<0019001D0016001500030024002800250003004800510046004F001100030047004C0056004D00110003004600520050005300110003004700480056000300490052005800550056>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 480.9 Td > Tj ET  BT 0.0 0.0 0.0 rg 1.0 
469.9 Td /F0 9.0 Tf 
<001A001D0015001B000300100003001A001D001600130003004700700046004F001100030047004C0056004D0011000300190018004E00390003004700480053004400550057000300260029002F0003006A000300270052005000500048004F004700440051004A00480003>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 458.9 Td /F0 9.0 Tf 
<0003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003001000100021000300470070005000110003002F0015000F002F0016>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 447.9 Td /F0 9.0 Tf 
<00030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030010001000210003004700700046004F001100030053004400550003002C000300210021>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 436.9 Td > Tj ET  BT 0.0 0.0 0.0 rg 1.0 
425.9 Td /F0 9.0 Tf 
<00140013001D0013001300030028002F002C0024000300500048005700030045004400550055004800030025001400030048005100030056004800550059004C004600480003006A000300240058004500440051004A0048>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 414.9 Td > Tj ET Q EMC
{noformat}
So there is a second Tj here "> Tj > Tj". Sadly PDFBox doesn't make a log 
message, maybe it happened too often, or maybe we forgot. I found it by opening 
the file with PDF.js and looking at the console. PDFBox takes this appearance 
stream and makes a content stream of the form XObject when flattening.


was (Author: tilman):
GIGO. The content stream of the appearance stream of the annotation widget of 
that field is:
{noformat}
q 1.0 1.0 1.0 rg 0 0 496.4 500.2 re f Q /Tx BMC q 0.0 0.0 496.4 500.2 re W n  
BT 0.0 0.0 0.0 rg 1.0 491.9 Td /F0 9.0 Tf 
<0019001D0016001500030024002800250003004800510046004F001100030047004C0056004D00110003004600520050005300110003004700480056000300490052005800550056>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 480.9 Td > Tj ET  BT 0.0 0.0 0.0 rg 1.0 
469.9 Td /F0 9.0 Tf 
<001A001D0015001B000300100003001A001D001600130003004700700046004F001100030047004C0056004D0011000300190018004E00390003004700480053004400550057000300260029002F0003006A000300270052005000500048004F004700440051004A00480003>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 458.9 Td /F0 9.0 Tf 
<0003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003001000100021000300470070005000110003002F0015000F002F0016>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 447.9 Td /F0 9.0 Tf 
<00030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030010001000210003004700700046004F001100030053004400550003002C000300210021>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 436.9 Td > Tj ET  BT 0.0 0.0 0.0 rg 1.0 
425.9 Td /F0 9.0 Tf 
<00140013001D0013001300030028002F002C0024000300500048005700030045004400550055004800030025001400030048005100030056004800550059004C004600480003006A000300240058004500440051004A0048>
 Tj > Tj ET  BT 0.0 0.0 0.0 rg 1.0 414.9 Td > Tj ET Q EMC
{noformat}
So there is a second Tj here "> Tj > Tj". Sadly PDFBox doesn't make a log 
message, maybe it happened too often, or maybe we forgot. I found it by opening 
the file with PDF.js and looking at the console. PDFBox takes this appearance 
streams and makes a content stream of the form XObject when flattening.

> flatten can corrput PDF file
> ----------------------------
>
>                 Key: PDFBOX-4812
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4812
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.19
>         Environment: Windows 7, Eclipse Neon, Java 8
>            Reporter: Jean-Pascal Laux
>            Priority: Major
>         Attachments: Rapport de poste 10042020 P1 flattened.pdf, Rapport de 
> poste 10042020 P1 original.pdf
>
>
> Hello,
> Depend of the content of the a text field, flatten create a PDF document 
> without the value of the text value and Acorbat REader gives a error message 
> when it opens the document.
> I have to rewrite the field value to have a correct PDF document.
> PDField field=form.getField("Détail page 1");
>  if (field!=null) field.setValue(field.getValueAsString());



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to