You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Роман Лебедев <le...@gmail.com> on 2017/04/10 17:56:40 UTC

Scaling page with PDFBox

Dear colleagues!

I want to resize pdf page with PDFBox 2.0. How should I do that? Is there
some method which allows this kind of job with versions 2.0 or 1.8?
Example of my code is attached.

Best regards,
Roman.

Re: Scaling page with PDFBox

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 10.04.2017 um 19:56 schrieb \u0420\u043e\u043c\u0430\u043d \u041b\u0435\u0431\u0435\u0434\u0435\u0432:
> Dear colleagues!
>
> I want to resize pdf page with PDFBox 2.0. How should I do that? Is 
> there some method which allows this kind of job with versions 2.0 or 1.8?
> Example of my code is attached.

Prepend a content stream that does your scaling. I.e. (in 2.0) create a 
PDPageContentStream with prepend option, there call

|contentStream.transform(Matrix.getScaleInstance(0.5,0.5)); |

and don't forget to close.

Tilman