Seeing your code snippet you're still creating a new Document with the
specified page size

   Document document = new Document(new Rectangle(0,42,4382,4369));

the reader you create PdfReader reader = new PdfReader("input.pdf"); is
nowhere used in your code.

So you actually don't do any page resizing on your existing pdf.

2008/10/24 Byomokesh Sahoo <[EMAIL PROTECTED]>

> Hi,
>
> Thanks for quick reply.
>
> I am trying to reduce or increase trim/Page size in Existing PDF file.
> Suppose my source existing PDF file size is 6.29x9.04in. I want call this
> PDF file then increase or decrease the page size. (example. i need
> 6.14x9.21in)
>
> PdfReader reader = new PdfReader("input.pdf");
> int n = reader.getNumberOfPages();
>       Document document = new Document(new Rectangle(0,42,4382,4369));
>         PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("Output.pdf"));
>         writer.setCropBoxSize(new Rectangle(7, 3, 726, 657));
>         writer.setBoxSize("bleed", new Rectangle(30, 30, 750, 750));
>         writer.setBoxSize("trim", new Rectangle(36, 36, 796, 856));
>         writer.setBoxSize("art", new Rectangle(72, 72, 860, 784));
>
> I am too much struggling to achive this.
>
>
> I need 4 types page size. (7.5x8.25in, 5.5x8.5in, 7.44x9.69in, 5.51x8.27).
> How i will achive easily please help me.
>
> Thanks
> Byomokesh
>
> >You'll have to explain what you mean by that.
> >In your code, you are creating a new PDF document.
> >However, in your first sentence you say you want to reduce
> >the page size. Do you want to reduce the page size of an
>
> >existing PDF? If so, what are you expecting? (Resizing and
> >reflow of the content or just cropping of the existing content?)
> --
> This answer is provided by 1T3XT BVBA
> http://www.1t3xt.com/ - http://www.1t3xt.info
>
>
>
> Byomokesh Sahoo wrote:
> >> Dear All,
> >>
> >> I wrote code to reduce page size using iText. I am getting calculate to
> >> increase or decrease page size.
> >>
> >> My code is here
>
> >>
> >> Rectangle pageSize = new Rectangle(4, 56, 4482, 8369);
> >> Document document = new Document(pageSize);
> >> PdfWriter writer = PdfWriter.getInstance(document, new
> >> FileOutputStream("Output.pdf"));
>
> >> writer.setCropBoxSize(new Rectangle(17, 63, 526, 657));
> >> writer.setBoxSize("bleed", new Rectangle(40, 40, 502, 562));
> >> writer.setBoxSize("trim", new Rectangle(36, 36, 396, 556));
>
> >> writer.setBoxSize("art", new Rectangle(72, 72, 360, 684));
> >>
> >> I need 4 types page size. (7.5x8.25in, 5.5x8.5in, 7.44x9.69in, 5.51x8.27).
> >>
> >> I could not get it to all page size. Please anyone help me.
>
>
>  <http://www.1t3xt.info/>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Buy the iText book: http://www.1t3xt.com/docs/book.php
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to