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

Andreas Lehmkühler commented on PDFBOX-854:
-------------------------------------------

The problem is the current transformation matrix (ctm). It is defined for every 
page and can't be reset to an user-defined value. Every change to it will be 
done by concatenating a new ctm to it (see cm-operator for further details). 
The matrix maps positions from user coordinates to device coordinates. In your 
case it is among other things used to create a landscape pdf. PDFBox provides a 
sample on how to create landscpae pdfs [1].
I don't know any way to get the ctm without parsing the contentstream before 
adding further content. Can you attach a iText example pdf? Probably we can 
learn from that how to compensate a ctm.


[1] 
http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/examples/pdmodel/CreateLandscapePDF.java?view=markup

> 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