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

MH edited comment on PDFBOX-854 at 10/8/10 5:20 AM:
----------------------------------------------------

Okay, the text is e.g. "23 - 35". Your questions about the used font are 
interesting: for the PDFs that "work", they are generated with the same fonts 
as the font used for the additional text, i.e. the font is also embedded in the 
PDF. For the external PDF, this must not necessarily be true! 

Just to repeat: if I exchange my method with the iText implementation, the text 
is written with the same parameters (PDF, Text, Font, etc.) => it's something 
within PDFBox.

I debugged my code again: I can't see any differences in the PDFBox calls. The 
font is also loaded. I use:

font = PDTrueTypeFont.loadTTF(doc, nameOfFont);

and the javadoc for this method says:

"This will load a TTF font from a font file.

doc The PDF document that will hold the embedded font.
file The file on the filesystem that holds the font file."

So it loads a font from the file system and embeds it in the destination 
document => the font has not to be embedded in the destination PDF as it is 
loaded from the file system and will be embedded in the destination doc.

Perhaps you will see the difference bettwer when you try to add text with a 
different font than any of the PDF fonts. (As this seems to be the problem.)

      was (Author: mhilpert):
    Okay, the text is e.g. "23 - 35". Your questions about the used font are 
interesting: for the PDFs that "work", they are generated with the same fonts 
as the font used for the additional text, i.e. the font is also embedded in the 
PDF. For the external PDF, this must not necessarily be true! 

Just to repeat: if I exchange my method with the iText implementation, the text 
is written with the same parameters (PDF, Text, Font, etc.) => it's something 
within PDFBox.
  
> 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.

Reply via email to