[
https://issues.apache.org/jira/browse/PDFBOX-3242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15155767#comment-15155767
]
Tilman Hausherr commented on PDFBOX-3242:
-----------------------------------------
This code reproduces the problem:
{code}
PDPageContentStream contents = new PDPageContentStream(doc, page,
true, false);
contents.setNonStrokingColor(Color.blue);
contents.appendRawCommands("10 700 20 20 re\n");
contents.fill();
contents.beginText();
contents.setFont(font, 12);
contents.newLineAtOffset(100, 700);
contents.showText("one");
contents.endText();
contents.setNonStrokingColor(0); // black
contents.appendRawCommands("10 600 20 20 re\n");
contents.fill();
contents.beginText();
contents.setFont(font, 12);
contents.newLineAtOffset(100, 600);
contents.showText("two");
contents.endText();
// this should be included in the content stream, but isn't.
//contents.appendRawCommands("/DeviceRGB cs\n");
contents.setNonStrokingColor(Color.red);
contents.appendRawCommands("10 500 20 20 re\n");
contents.fill();
contents.beginText();
contents.setFont(font, 12);
contents.newLineAtOffset(100, 500);
contents.showText("three");
contents.endText();
contents.close();
{code}
The third line is invisible, unless the /DeviceRGB line is activated. I think
the problem is that the operators that set a device color (which are used when
the method is called with a number) modify the colorspace, but this isn't
"remembered" in the ColorSpaceStack.
> Problem displaying document created by PDFBox 2.0RC3 in Acrobat Reader
> ----------------------------------------------------------------------
>
> Key: PDFBOX-3242
> URL: https://issues.apache.org/jira/browse/PDFBOX-3242
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Affects Versions: 2.0.0
> Reporter: Tilman Hausherr
> Attachments: CFPBClosingDisclosure-PDFBox1811.pdf,
> CFPBClosingDisclosure-PDFBox200RC3.pdf
>
>
> As reported by John Liston in the user mailing list:
> {quote}
> A document generated using PDFBox 2.0.0-RC3 cannot be read fully by the
> latest version of Adobe Acrobat Reader, which says "An error exists on this
> page. Acrobat may not display the page correctly. Please contact the person
> who created the PDF document to correct the problem." The identical document
> created using PDFBox 1.8.11 reads in Acrobat Reader just fine. After using
> Acrobat Pro to increase the width of the bounding box around the first page
> text "Can this amount change after closing?", the rest of the text on the
> page showed up. The same problem showed up with other text on the following
> pages. Both documents read and display properly using PDFBox PDFDebugger.
> {quote}
> Files from 1.8 and 2.0RC3 are attached. Analysis showed one bug that has
> already been fixed (PDFBOX-3240). The other bug is that everywhere where
> there's an "n n n sc" command,
> {code}
> /DeviceRGB cs
> {code}
> is missing before except the first time it is used. Inserting it makes it
> work again.
> In 1.8 different operators are used (rg instead of sc).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]