On 10 Dec 2008, at 17:34, Ashish Kulkarni wrote:
I am creating a PDF file using FOP and then mergint his PDF file
with another PDF file using itext.
The issue is page numbers, for example if PDF file created by FOP
has 1 page, then i get page 1 of 1 when using tag
Page: <fo:page-number /> of <fo:page-number-citation ref-
id="last-page" />
But when i merge PDF it does really reflect the total
I know the PDF file which i am merging is 3 pages, can i some manage
to get 1 of 4 or change the page number in PDF file after merging,
any idea if i can do it from itext?
Should be possible, yes. On the condition that you can 'identify' the
piece of text in question. Knowing /where/ on the page it ends up is
enough, as you could then use iText to insert a new text-box at that
position, which would be painted over the page-number generated by FOP.
If you're willing to consider other options than iText, then I think
something like this would be relatively easy using FOP's intermediate
format. The downside is that this format is not well-documented, and
is currently being redesigned, so will change significantly in the
next release. Of course, we will not suddenly discontinue support for
the area tree format...
Using the current intermediate Area Tree, it is quite simple:
- render all your documents to the XML Area Tree format, and be sure
to specify an 'id' on the fo:page-number-citations
- the specified 'id' can then serve to identify the text areas and
replace the text with the total page-count by means of a pure XSLT
stylesheet. The 'id' property is translated to a 'prod-id' attribute
on the corresponding areas in the area tree.
You then have the choice of merging all the area trees before doing
the final rendering, or render the files individually and keep using
iText to merge them.
For more info, see: http://xmlgraphics.apache.org/fop/0.95/intermediate.html
Cheers
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]