Hi Brandon,

Brandon Berry schrieb:
> How do I write rotated text to a page?
> 
> I have a PDF document that was created externally with a landscape
> orientation. It appears fine when viewed with text going left to right. But
> PDFBox sees it as having a portrait orientation and rotated 90 degrees.
> 
> So when I add text to the page, it gets written perpendicular to the
> existing text, going from bottom to top with respect to how the document is
> viewed. I'm thinking I either need to rotate the text being added or
> convince PDFBox it's landscape with no rotation.
> 
> Looking through the mailing list archives, I think I found some discussions
> that might be related but found no solutions. I had previously been thinking
> I would need to use a transformation matrix and that subject did come up in
> those discussions. But I can't find anyway to apply any transformations from
> the methods available to me. Is that the correct approach?
You are right. You have to use an additional textmatrix to rotate the
text. But I'm afraid there is yet no easy way to add it the
contentstream. You have to add all pdf commands on your own using the
appaendRawCommand method in PDPageContentStream.
I've created a new issue on jira [1] to keep that in mind. I'll need
that missing feature sooner or later too.

BR
Andreas Lehmkühler

[1] https://issues.apache.org/jira/browse/PDFBOX-505
  • Rotate Text Brandon Berry
    • Re: Rotate Text Andreas Lehmkühler

Reply via email to