You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Tom Eicher <te...@teicher.net> on 2022/04/09 13:00:14 UTC
Mirrored text when drawing in a loaded pdf
Hello,
in my application I use pdfbox 2.0.22 to create documents.
I load a (customer supplied) template, then write my content
onto it. That works very fine.
But now one customer manager to produce a template where
my content is drawn mirrored (bottom-up) onto the document.
(Of course, a winword-created template PDF) - see attached.
Do I have chance to somehow reset any applied
transformations, rotations or similar so I can draw
on the document like I would draw on a blank page?
PDDocument doc = new PDDocument();
PDDocument templatedoc = PDDocument.load(templateInpuStrean);
PDPage page = doc.importPage(templatedoc.getPage(0));
PDPageContentStream contentStream =
new PDPageContentStream(doc, page, true, true);
contentStream.setFont(PDType1Font.COURIER, HEIGHTY);
contentStream.setLeading(OFFSETY);
contentStream.beginText();
y-=OFFSETY*16;
contentStream.newLineAtOffset(x, y);
contentStream.showText("Text Line 1...");
Any hints appreciated...
Thx&Cheers Tom.
Re: Mirrored text when drawing in a loaded pdf
Posted by Tom Eicher <te...@teicher.net>.
Works! So that was easy.
No idea why I missed this in the first place, sorry.
Thanks Tilman!
Am 10.04.22 um 06:32 schrieb Tilman Hausherr:
> Use the PDPageContentStream constructor with five parameters
>
> Tilman
>
> Am 09.04.2022 um 15:00 schrieb Tom Eicher:
>> Hello,
>>
>> in my application I use pdfbox 2.0.22 to create documents.
>> I load a (customer supplied) template, then write my content
>> onto it. That works very fine.
>>
>> But now one customer manager to produce a template where
>> my content is drawn mirrored (bottom-up) onto the document.
>> (Of course, a winword-created template PDF) - see attached.
>>
>> Do I have chance to somehow reset any applied
>> transformations, rotations or similar so I can draw
>> on the document like I would draw on a blank page?
>>
>> PDDocument doc = new PDDocument();
>> PDDocument templatedoc = PDDocument.load(templateInpuStrean);
>>
>> PDPage page = doc.importPage(templatedoc.getPage(0));
>> PDPageContentStream contentStream =
>> new PDPageContentStream(doc, page, true, true);
>> contentStream.setFont(PDType1Font.COURIER, HEIGHTY);
>> contentStream.setLeading(OFFSETY);
>> contentStream.beginText();
>> y-=OFFSETY*16;
>> contentStream.newLineAtOffset(x, y);
>> contentStream.showText("Text Line 1...");
>>
>> Any hints appreciated...
>>
>> Thx&Cheers Tom.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: Mirrored text when drawing in a loaded pdf
Posted by Tilman Hausherr <TH...@t-online.de>.
Use the PDPageContentStream constructor with five parameters
Tilman
Am 09.04.2022 um 15:00 schrieb Tom Eicher:
> Hello,
>
> in my application I use pdfbox 2.0.22 to create documents.
> I load a (customer supplied) template, then write my content
> onto it. That works very fine.
>
> But now one customer manager to produce a template where
> my content is drawn mirrored (bottom-up) onto the document.
> (Of course, a winword-created template PDF) - see attached.
>
> Do I have chance to somehow reset any applied
> transformations, rotations or similar so I can draw
> on the document like I would draw on a blank page?
>
> PDDocument doc = new PDDocument();
> PDDocument templatedoc = PDDocument.load(templateInpuStrean);
>
> PDPage page = doc.importPage(templatedoc.getPage(0));
> PDPageContentStream contentStream =
> new PDPageContentStream(doc, page, true, true);
> contentStream.setFont(PDType1Font.COURIER, HEIGHTY);
> contentStream.setLeading(OFFSETY);
> contentStream.beginText();
> y-=OFFSETY*16;
> contentStream.newLineAtOffset(x, y);
> contentStream.showText("Text Line 1...");
>
> Any hints appreciated...
>
> Thx&Cheers Tom.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org