[
https://issues.apache.org/jira/browse/PDFBOX-854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919003#action_12919003
]
MH edited comment on PDFBOX-854 at 10/7/10 2:25 PM:
----------------------------------------------------
The text consists of numbers/digits, spaces and '-' signs. The font doesn't
matter as the same behaviour is for arbitrary fonts. Yes I saved the PDF of
course, otherwise I wouldn't see the result. This is not a "first
implementation" bug, as adding this text was formelry done with iText 2.1.7.
Then I change the implementation to use PDFBox and it worked without errors as
expected, i.e. the text is written as expected. This works for self-generated
PDFs via Apache FOP that are postprocessed with PDFBox (contatenation,
properties setting). The last step is adding text to a document. And now I have
some external PDFs like I posted as an attachement (generated via Windows print
to PDF printer that generates the PDF with Ghostscript). And the very same code
that writes the text to all other PDF pages, fails with this PDF - with
"fails", I mean: the resulting PDF does not show the text added. I debugged my
method to see if there is some swallowed exception, but the debugger steps as
expected through each line as with all other PDFs, with same page size, same
fonts, same x/y location of the text, even same text content, for not encrypted
PDFs. So, no error, no exception, but the resulting PDF does not have/show the
added text. I also tried the latest 1.3.0-snapshot of PDFBox, but without any
progress.
was (Author: mhilpert):
The text consists of numbers/digits, spaces and '-' signs. The font doesn't
matter as the same behaviour is for arbitrary fonts. Yes I saved the PDF of
course, otherwise I wouldn't see the result. This is not a "first
implementation" bug, as adding this text was formelry done with iText 2.1.7.
Then I change the implementation to use PDFBox and it worked without errors as
expected, i.e. the text is written as expected. This works for self-generated
PDFs via Apache FOP that are postprocessed with PDFBox (contatenation,
properties setting). The last step is adding text to a document. And now I have
some external PDFs like I posted as an attachement (generated via Windows print
to PDF printer that generates the PDF with Ghostscript). And the very same code
that writes the text to all other PDF pages, fails with this PDF - with
"fails", I mean: the resulting PDF does not show the text added. I debugged my
method to see if there is some swallowed exception, but the debugger steps as
expected through each line as with all other PDFs, with same page size, same
fonts, same x/y location of the text, even same text content, for not encrypted
PDFs. So, no error, no exception, but the resulting PDF does not have/show the
added text.
> PDPageContentStream.drawString() doesn't work with all PDFs
> -----------------------------------------------------------
>
> Key: PDFBOX-854
> URL: https://issues.apache.org/jira/browse/PDFBOX-854
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 1.3.0
> Environment: JDK 1.6.0_21
> Reporter: MH
> Attachments: Website_A4_Landscape_PDF14.zip
>
>
> I add custom text to misc exsiting PDF files. Now I wondered why my text
> doesn't appear for a specific PDF. It is not encrypted, has the same page
> size and adding Text with iText 2.1.7 works as expected. My code to add text
> is:
> ----------------------------------
> final PDPage page = (PDPage) allPages.get(i);
> final PDPageContentStream contentStream = new
> PDPageContentStream(doc, page, true, false);
> contentStream.beginText();
> contentStream.setFont(font, sizeOfFont);
> contentStream.moveTextPositionByAmount(xf, yf);
> contentStream.drawString(text);
> contentStream.endText();
> contentStream.close();
> ---------------------------------
> I tried to find differences between this PDF and other PDFs. What I noticed:
> the PDF where I can't see the text has a PDF-Version "1.3" and was created by
> "AFPL Ghostscript 8.54". Is there some known issue with PDFBox and such
> "older" PDF formats?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.