Best Methodology for naming PDF Pages Uniquely  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Best Methodology for naming PDF Pages Uniquely

Post by Lambchop »

Problem Description: I need a way to "name" a PDF page separate from the document properties. For example, if I have 3 pages in a document, I can rename each to be "Mo", "Joe", and "Curly" and the page numbers are treated differently from this "name".

I need to establish some of my basic understanding, so please correct me if I am wrong on any of these items.
1) within Tracker, PDF Page labels are read-only and are dependent on the page number
2) A PDF Page label within Tracker is not designed to be used as free flowing text property
3) there is no way to change individual page descriptions (i.e. page names, or page labels) using the PDF XChange Editor
4) there is page numbering and Bates numbering (open text), but you cannot have both for a PDF page
5) Using Bookmarks is the BEST Methodology
6) There is no Bookmark "type" so matching to a particular bookmark entry reference vs another bookmark entry is not possible

Questions:
1) what should be used to "name" a page within a PDF document if page label is not the correct approach? (i.e. is bookmark the way to go?)
2) how would you change this "name" property (e.g. if using page label, how would this be changed so that page numbering would not affect it).
3) if using a read-only page property (e.g. page label), how is this changed programmatically?
4) can there be redundant page labels? (i.e. is there an issue if 2 PDF documents are merged with the same PDF label or bookmark? My tests show that these labels are automatically getting changed upon merge and the bookmarks seem to allow redundant)

Many Thanks
-Eric
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8440
Joined: Wed Jan 03, 2018 6:52 pm

Re: Best Methodology for naming PDF Pages Uniquely

Post by TrackerSupp-Daniel »

Hello, Lambchop

Your first 5 statements are incorrect, lets go through them in groups where possible. Before that however, you may wish to take a look at this KB article: https://www.pdf-xchange.com/knowle ... Thumbnails

1-3)
You can modify the "page labels" with the "number pages" tool, easily accessed through the thumbnails pane:
image.png
Within this menu, you can specify numerous ways to split your page ranges, and label them, including with no numerical identifier, and with a single line text entry instead.
Do note that page labelles changed this way will not be visible to users of any software which is incapable of using "logical page numbering" or which has this option disabled. Our Editor has it disabled by default, and you will need to enable it through the preferences before you can see the results of any changes you make:
image(1).png
4)
You can apply both bates number and normal page numbering to your document, the two are independent functions and do not interfere with each other.
image(2).png
5)
Using bookmarks is certainly an option depending on your use, but I do not think it would be considered the best way to label pages, especially considering that they do not modify page labels at all.

6)
This notion is correct, it is not possible for a bookmark to point to another bookmark, think of Bookmarks are simply a catalogue of directions. Typically they point to a specific location in the document, sort of like dropping a pin on a map, there wouldnt be any purpose to dropping a pin on top of another pin on a map, since that location is already pinned. On the other hand, you can create multiple "named destinations" which act much like bookmarks, except you can think of them like stickers on the map, (imagine that you have special "McDonalds" stickers, which you place Golden Arches on the world famous restaurant all over the map), then you can have bookmarks point to one of these specific named destinations (by placing the pins on the stickers), and in turn, set multiple bookmarks to go to the same one.


On to your questions now!
1) Page labels is indeed the correct approach, unless you mean something completely different when you say page labels.
2) Should you need to modify the page labels, you would use the same process as you use to create them normally, as detailed in the KB article at the top of my post here.
3) Since it is not read only, this is irrelevant
4) Yes, you can have redundant page labels. When page labels are present and you are viewing one, you will see the label in the page number box at the bottom of the Editor, along with the actual physical page number slightly smaller beside it. This allows you to have multiple sections which are "labelled" as pages 1-5 if you so choose, but when looking at page 2 of the second section, you would also know you are on the 7th page of the document.

I hope this helps!

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Lambchop
User
Posts: 34
Joined: Mon May 02, 2022 5:58 pm

Re: Best Methodology for naming PDF Pages Uniquely

Post by Lambchop »

Daniel - Uhhmmmm... I did post my question in the SDK forum so I was expecting a coding response. However, your excellent screenshots were very helpful for perspective. Everything I was posting involves the code directly. For example, off the PDFXEdit.IPXC_Page, the IPXC_Page.Label is READ ONLY.
There are disjointed forum posts like this one on bookmarks: https://forum.pdf-xchange.com/viewtopic.php?p=136775&hilit=bookmarks#p136775
But I have not yet found any functional code samples showing bookmark management.

I understand that page numbers and Bates numbering are different, but the code properties set to the page label appear to be the same, thus my question.

What I was expecting was a Tracker programmer to reference Custom Labels as in this:
https://sdkhelp.pdf-xchange.com/view/PXV:IUIX_CustomLabelsProvider_GetCustomLabel

But Custom Label seems to be specific to thumbnails and not a PDF page, so I do not see how I can get it to work off of the PDF Page object.

While I recognize that the PDF standard was not designed for what so many of us developers are trying to make it do, Tracker has so much incredible power that I am going to ask anyway with the hopes there is a solution. Let me post more of a "developer like" question.

Problem: I need to treat each PDF page object (i.e. PDFXEdit.IPXC_Page) like a separate object with unique properties. One of these properties needs to be an editable "name" that can be changed. Other desired properties per PDF page would include: tag, key, ID. None of this information is required to be read by another PDF viewer, but this information cannot cause another PDF viewer to crash upon opening (e.g. due to a nonconformity standard). In addition, none of these properties are exposed to the user through the UI.

Acknowledgement: I do not believe that PDF documents have these properties on a page level as pages themselves are basically a dimensional construct within a PDF document. This is the whole problem, what I am trying to do exists at the document level, not the page level. I would like a programming reply if possible. :wink:
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Best Methodology for naming PDF Pages Uniquely  SOLVED

Post by Vasyl-Tracker Dev Team »

Hi Eric.

Unfortunately, but Page Label - isn't just a simple attribute of page-object. In pdf the page labelling is a complex task. All existing page labels you may see in doc - inside pdf it is a list of abstract rules like:

rule = [startFromPage=<pageIndex>, style={ "1,2,3.." or "I, II, II..." or "A, B, C..."}, prefix=<anyText>, startAt=<anyPositiveNum>]
and to get display text for certain page the pdf-viewer app uses this algorithm:

Code: Select all

rule = getRuleForPage(pageIndex);

numToDisplay = pageIndex - rule.startFromPage + rule.startAt;
pageDisplayLabel = rule.prefix + rule.NumToTextByStyle(numToDisplay);
so, for example, to make the following labels in doc:

I, II, III, IV, 5, 6, 7, 8, 9 ...

you need to have this list of rules:

rule1=[startFromPage=0, style="I, II, II...", prefix="", startAt=1], rule2=[startFromPage=4, style="1,2,3...", prefix="", startAt=5]

for:

1, 2, 3, "Good Day", 5, 6, 7, ...

it will be:

rule1=[startFromPage=3, style="", prefix="Good Day", startAt=1], rule2=[startFromPage=4, style="1,2,3...", prefix="", startAt=5]

======================

Finally, in Editor SDK we have an operation that allows you to set the rules to the doc - the op.document.pageNumbering. The pseudocode:

Code: Select all

// for
// 1, 2, 3, "Good Day", 5, 6, 7, ...

op.Params["Input"] = doc;

opts = op.Params["Options"];
rules = opts["PDFRangeItems"];

// rule1=[startFromPage=3, style="", prefix="Good Day", startAt=1]
{
   rule = items.Add();
   rule["StartPage"] = 3;
   rule["Style"] = 0; // 0 - "", 1 - "1,2,3..", 2 - "I, II, III..", 3 - "i,ii,iii..", 4 - "A,B,C..", 5 - "a,b,c.."
   rule["Prefix"] = "Good Day";
   rule["StartNum"] = 1;
}

// rule2=[startFromPage=4, style="1,2,3...", prefix="", startAt=5]
{
   rule = items.Add();
   rule["StartPage"] = 4;
   rule["Style"] = 1;
   rule["Prefix"] = "";
   rule["StartNum"] = 5;
}

op.Do();
HTH
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply