Renumbering pages

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, 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
Bernhard
User
Posts: 7
Joined: Thu Oct 27, 2016 3:36 pm

Renumbering pages

Post by Bernhard »

Hello,
After the insert of new pages or pdf documents I want to renumber the resulting document.
I also want to remove the existing page numbers.
1st - How can I remove existing HeaderAndFooterParams?
2nd - Renumbering with my Code:

PDFXCoreAPI.IBitSet bs = PDFCoreSDK.m_PDFCoreAPI_IAUXInst.CreateBitSet(numPages);
bs.Set(0, numPages - 1);
PDFXCoreAPI.IPXC_HeaderAndFooterParams hfParams = PDFCoreSDK.GetPDFInst().CreateHeaderAndFooterParams();

hfParams.Start = 0;
hfParams.End = (int)(numPages - 1);
hfParams.StartPageNumber = 1;

// hfParams.CenterHeaderText = "1 of n";
hfParams.RightHeaderText = "<<1 of n>>";

m_IDocument.PlaceHeadersAndFooters(bs, hfParams);

I am using the PDF XChange Editor to check the resulting changes in the document:
  • hfParams.CenterHeaderText = "<<1 of n>>" results in ">" as the macro text
    hfParams.CenterHeaderText = "1 of n" results in "1 of n" as the macro text
In both cases I don't get the page numbers.

Thanks four your help in advance
Bernhard
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Renumbering pages

Post by Sasha - Tracker Dev Team »

Hello Bernhard,

1) Pagemark removing is only available from the Editor SDK by using corresponding Remove Operations. To remove the Pagemarks from the Core API level you will have to do everything manually, meaning you will have to find correspondent content items on pages and remove them.
2) The macro parsing is also being done on the Editor SDK level in the correspondent operations. In your case, you will have to call the Place method for each individual page with the text you need - that should work.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply