1
votes

I am using PdfSharp/Itextsharp to stitch together a number of documents and stamp a page number at the bottom of each page. The first document in the package is the Table of Contents and is not paginated. I start the pagination with the first page after ToC. The problem is the page number that is displayed on the document is not the same as the page number indicated by the Adobe Reader.

I checked with other documents and it looks like pdf supports the option to somehow reset the page number so page 1 can start again later in the document.

How can I do this with pdfsharp or itextsharp?

1

1 Answers

2
votes

The page numbers shown in Adobe Reader are defined by "Page Labels".

For instance: you number the TOC with i, ii, iii, iv, v and so on. The real page numbers are 1, 2, 3, 4, 5, and so on.

Here's a Java example from my book that shows how to work with Page Labels: http://itextpdf.com/examples/iia.php?id=234 [archived] It should be very easy to adapt it for use in C#.

If not, look for the corresponding example on this site: http://kuujinbo.info/iTextInAction2Ed/index.aspx