Hi everybody,
I have a need to concatenate multiple PDF documents and, at the same time,
include additional text such as total page number and so on. Another need is to
retain the bookmarks from the original documents and create a table of content
for the resulting document.
I got inspired by concat_pdf and I use SimpleBookmark for bookmarks and get
direct content to use PDFContentByte's methods to add my own text.
Somehow, PdfCopy's call to PdfContentByte's method have proven not to work.
Below is a snippet of my code:
pdfCopy = new PdfCopy(document, new FileOutputStream(MyFile));
PdfContentByte contentByte = pdfCopy.getDirectContent();
page = pdfCopy.getImportedPage(reader, i);
contentByte.addTemplate(page, 0, 0);
contentByte.beginText();
contentByte.setFontAndSize(baseFont, 14);
contentByte.showTextAligned(PdfContentByte.ALIGN_RIGHT, "Page " +
currentPageNumber+ " of " + totalNumberOfPages, width, 10, 0);
contentByte.endText();
Replacing PdfCopy by PdfWriter allows me to display the text but I can then not
use setOutlines() for the bookmarks since it is a PdfCopy's method. How can I
combine both needs of having bookmarks and direct content access? Maybe it can
be done with PdfCopy but my code is flawed???
Thanks.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions