I create TOC(Table Of Contents) in PDF.
I create TOC at the end of the document, and
I reorder it.
But reordered PDF has empty last page.

I consulted ReorderPages.java .
I thought Document#newPage() before PdfWriter#reorderPages() wasn't necessary.
But That will report an error.

My Code is below:
-------------------------------------
Document document = new Document(PageSize.A4, 50, 50, 50, 50);
PdfWriter writer = PdfWriter.getInstance(document, new 
FileOutputStream("C:\\ITextTest.pdf"));
writer.setLinearPageMode();
document.open();

// PDF Contents Create
// TOC Create ( at the end of the document)

int totalPages = writer.getPageNumber();
int[] reorder = new int[totalPages];
reorder[0] = 1;
reorder[1] = totalPages;
for (int i = 2; i < totalPages; i++) {
    reorder[i] = i;
}
document.newPage();
writer.reorderPages(reorder);
-------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to