PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Adding a Page Label
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4309
Page 1 of 1

Author:  gtm [ Thu Dec 16, 2021 11:18 pm ]
Post subject:  Adding a Page Label

I would like to add a page label to each page I create in a document. Is there a way I can do this with PDFsharp? I have looked at many examples but can't seem to find anything that does what I'm looking for.

Author:  TH-Soft [ Fri Dec 17, 2021 7:43 am ]
Post subject:  Re: Adding a Page Label

gtm wrote:
I would like to add a page label to each page I create in a document.
What is a "page label"?

Author:  gtm [ Fri Dec 17, 2021 3:53 pm ]
Post subject:  Re: Adding a Page Label

TH-Soft wrote:
gtm wrote:
I would like to add a page label to each page I create in a document.
What is a "page label"?


I guess I picked up the term from a PDF viewer called BlueBeam. It is the title that is attached to the page but is not displayed on the page.
On Adobe Acrobat Reader, it is displayed on the top tool bar to the right of the up and down arrows and just before the (current page number of total page numbers).

This is what it looks like in the PDF File.

4 0 obj
<</Type/Catalog/Pages 2 0 R/PageLabels<</Nums[0<</P(SK1)>>]>>>>
endobj

SK1 is the text I'm looking to get access to. Can you help?

Author:  gtm [ Sat Jan 08, 2022 8:57 pm ]
Post subject:  Re: Adding a Page Label

TH-Soft, Is there any information you can give me on creating a page label? I have found this in the PDFsharp open source code.

// <summary>
/// (Optional; PDF 1.3) A number tree defining the page labeling for the document.
/// The keys in this tree are page indices; the corresponding values are page label dictionaries.
/// Each page index denotes the first page in a labeling range to which the specified page
/// label dictionary applies. The tree must include a value for pageindex 0.
/// </summary>
[KeyInfo("1.3", KeyType.NumberTree | KeyType.Optional)]
public const string PageLabels = "/PageLabels";

It looks like there should be a way to access it. Does anyone know how to access a number tree?

Thanks,
Todd

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/