facebooktwittermenuarrow-up

GemBox Support Forum

Add PageNumbers in PDF

Hi.
For example: I have a pdf file with 6 pages inside.

Now, I need to insert page numbers (even, odd):
1,2 pages - title pages 1,
3,4 pages - title page 2,
5,6 pages - title page 3.

Another words: The first two pages will have the number 1
The second two pages will have the number 2
The third two pages will have the number 3
ETC

Thanks

Hi,

Are these title numbers just sequential?

If yes, then you can use the SEQ field.
For example, something like this:

var title1 = new Paragraph(document);
title1.Inlines.Add(new Run(document, "title page "));
title1.Inlines.Add(new Field(document, FieldType.Seq, "MyTitleSeq"));

document.Sections[0].Blocks.Add(title1);

var title2 = new Paragraph(document);
title2.Inlines.Add(new Run(document, "title page "));
title2.Inlines.Add(new Field(document, FieldType.Seq, "MyTitleSeq"));
document.Sections[0].Blocks.Add(title2);

document.GetPaginator(new PaginatorOptions() { UpdateFields = true });

I hope this helps.

Regards,
Mario