Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions] Help needed - asap

Bruno

2007-07-31


yazhini.subramanian@(protected):
> My requirement is:
>
>         Merge n number of pdf files to one new pdf file (everything
> from the page sizes, fonts, spacing, potraits etc). My input pdfs are of
> different sizes and shapes.

You should use PdfCopy for this. NOT PdfWriter.
The code you have sent in attachment doesn't respect
the page size (could easily be fixed by changing the
page size before adding the template), nor does it
copy any interactive features (a bit more difficult,
that's why you should use PdfCopy instead).

> Remove the already existing page number and add a new page
> number of this format <page of total pages>.

After using PdfCopy to concatenate, use PdfStamper
in a second pass to add the new page numbers.

Removing the existing page numbers is almost impossible
(not an iText limitation, it's impossible in general).

Either you are a specialist in PDF syntax and you
succeed in changing the content stream as explained
in the "don't try this at home" example in Chapter 18
of the book.

Or you somehow know the coordinates of the existing
page numbers and you cover them with a white rectangle.

>         The pages are not the same as the input pages. I am not able
> to set individual page sizes. Hence the contents are getting compressed
> kinda.

It's being clipped; not compressed.

> Not able to remove the existing page numbers though I have
> added the new ones.

That's inherent to the PDF format.
There is no structure in a (normal) PDF file.
The concept of page numbers is lost when a PDF is
generated. It's just some glyphs painted somewhere
on a page at some specific coordinates.
There's no way to retrieve those coordinates
automatically.

> Kindly help out asap as it of urgency.

Note that the words ASAP and URGENT are forbidden on
this mailing list (several people here are allergic
to them). We don't use those words, even if we have
tight deadlines in our dayjobs.
best regards,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
©2008 junlu.com - Jax Systems, LLC, U.S.A.