logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

New Topic Post Reply
Options
Go to last post Go to first unread
bav  
#1 Posted : Tuesday, February 14, 2023 9:02:23 AM(UTC)
Quote
bav

Rank: Newbie

Groups: Registered
Joined: 1/11/2023(UTC)
Posts: 7
United States

One of my requirements is to be able to set page labels as pages get added to my output document. Is this possible with Patagames pdfium SDK?

If the page label entry already exists (document.Root.GetBy("PageLabels") then I can see it in the dictionary, but I cannot figure out how to parse them properly.

var dictionary = Document.Root;
var pageLabelTreeIndirect = (PdfTypeIndirect)dictionary.GetBy(pageLabelsKey);
var pageLabelTree = (PdfTypeDictionary) pageLabelTreeIndirect.Direct;


The pageLabelTree object is a dictionary that only supports strings as keys. The only key I see in the dictionary is "Nums". I did try adding an entry into the dictionary, but it doesn't seem to do anything.

var thisPagesLabelDictionary = PdfTypeDictionary.Create();
thisPagesLabelDictionary["P"] = PdfTypeString.Create("TEST PAGE");
pageLabelTree.Add("0", thisPagesLabelDictionary);


Has anyone gotten this to work? It's very straight forward with iText, but they obviously mask the complexity.
Paul Rayman  
#2 Posted : Wednesday, March 15, 2023 1:50:39 AM(UTC)
Quote
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,097

Thanks: 7 times
Was thanked: 128 time(s) in 125 post(s)
Hello,

Please update to the latest version.
The page label functionality is now implemented in a few easy-to-understand classes.
Here are the details: https://pdfium.patagames...orkingSDK_PageLabels.htm
bav  
#3 Posted : Wednesday, March 15, 2023 3:35:52 PM(UTC)
Quote
bav

Rank: Newbie

Groups: Registered
Joined: 1/11/2023(UTC)
Posts: 7
United States

Nice job! This seems to work as expected. Much simpler. Thank you.
Quick Reply Show Quick Reply
Users browsing this topic
New Topic Post Reply
Forum Jump  
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.