Bates numbering question

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
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Bates numbering question

Post by jusWest »

Hi!

I am sure I am overlooking something basic here, but anyways, here goes.

We want to start bates/page numbering from a specific page and from a specific number, like
from page 2 with page number 2

Starting from the page I want works, but I cant get the page number to start from where I want it. Her is the code I use:

Code: Select all

                int nID = _Inst.Str2ID("op.document.addBatesNumbering", false);
                IOperation Op = _Inst.CreateOp(nID);
                var input = Op.Params.Root["Input"];
                input.v = _Doc.CoreDoc;
                ICabNode options = Op.Params.Root["Options"];

                ICabNode pagesRange = options["PagesRange"];
                RangeType rangeType = RangeType.RangeType_All;

                // the user wants to start the numbering from a specific page,
                // then we have to change type and range
                if (frompage > 1)
                {
                    rangeType = RangeType.RangeType_Exact;
                    pagesRange["Text"].v = frompage + "-" + _Doc.CoreDoc.Pages.Count;
                }

                pagesRange["Type"].v = rangeType;
                pagesRange["Filter"].v = rangeType;

                options["PageNumberFormat"].v = "1"; 

                // start from page number
                options["StartPageNumber"].v = fromnumber;

                options["Font.Size"].v = 18;
                options["Font.FColor"].v = fontColor;

                Op.Do();

What am I doing wrong?

Regards
Ronny
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Bates numbering question

Post by Sasha - Tracker Dev Team »

Hello Ronny,

Can you achieve this in the End-User Editor with the Bates macro? If so, then just use the corresponded macro in one of the text parameters and it should work like you want, for example:

Code: Select all

options["RightHeaderText"].v = "%[Bates]";
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
jusWest
User
Posts: 150
Joined: Fri Aug 24, 2018 8:26 am

Re: Bates numbering question

Post by jusWest »

Oh, seems like I have overcomplicated things, that works, thank you :)
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Bates numbering question

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply