Highlighted

Set Properties to Display Logical Page in Acrobat Reader?

Explorer ,
Jun 26, 2018

Copy link to clipboard

Copied

Dear community,

What bothers me is the page numbering in the toolbar of the PDF Reader. In my documents, the TOC is Roman numbering and the rest is Arabic numbering, however the toolbar does not display iii (3 of 900) nor 1 (20 of 900) for the first page of the first chapter. Instead it displays 3 (3 of 900) and 20 (20 of 900) although "Use logical page number" is checked in the preferences.

The documents I publish are made from a *.book with several components:

  • First component: Title page with copyright
  • Next component: Table of content
  • Following components: The chapters and an index

I suppose I have to set some sort of properties somehow somewhere in here:

book.PDFPageHeight = 297 * 185771;

book.PDFPageWidth  = 210 * 185771;

var comp = book.FirstComponentInBook;

while(comp.ObjectValid()) {

    var openParams = GetOpenDefaultParams ();

    var i = GetPropIndex(openParams, Constants.FS_UpdateXRefs);

    openParams.propVal.ival = Constants.FV_DoOK;

    var doc = Open(comp.Name, openParams, new PropVals());

    doc.PDFBookmark = true;

    doc.DocAcrobatElements = false;

    comp = comp.NextBookComponentInDFSOrder;

}   

var params = GetSaveDefaultParams();

var index = GetPropIndex(params, Constants.FS_FileType);

params[index].propVal.ival = Constants.FV_SaveFmtPdf;

var pdfDocInfo = new Strings();

pdfDocInfo.push("Author");

pdfDocInfo.push("XXX GmbH");

book.PDFDocInfo = pdfDocInfo;

book.Save(pdfPath, params, new PropVals());

I checked the value of "comp.FirstPageNum" for all the components. The value for the first component with a chapter is "1" as it should be.

Best regards,

Fabian

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

Hi Fabian,

Here is an example of the output from my PageLabeler script.

/pdfmark where { pop} { userdict /pdfmark /cleartomark load put} ifelse

[ {Catalog} << /PageLabels << /Nums [

0 << /S  /r  /St 1 /P () >>

1 << /S  /r  /St 2 /P () >>

2 << /S  /D  /St 1 /P (1-) >>

] >> >> /PUT pdfmark

This goes into a PostScript text frame on the first body page of the last component in the book. Each line starting with 03 represents the page numbering for each of the components in the book. The required syntax is documented in Adobe's pdfmark Reference manual. The site license version of my PageLabeler script includes the source code and you may be able to integrate it into your own process.

-Rick

TOPICS
Scripting

Views

375

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Set Properties to Display Logical Page in Acrobat Reader?

Explorer ,
Jun 26, 2018

Copy link to clipboard

Copied

Dear community,

What bothers me is the page numbering in the toolbar of the PDF Reader. In my documents, the TOC is Roman numbering and the rest is Arabic numbering, however the toolbar does not display iii (3 of 900) nor 1 (20 of 900) for the first page of the first chapter. Instead it displays 3 (3 of 900) and 20 (20 of 900) although "Use logical page number" is checked in the preferences.

The documents I publish are made from a *.book with several components:

  • First component: Title page with copyright
  • Next component: Table of content
  • Following components: The chapters and an index

I suppose I have to set some sort of properties somehow somewhere in here:

book.PDFPageHeight = 297 * 185771;

book.PDFPageWidth  = 210 * 185771;

var comp = book.FirstComponentInBook;

while(comp.ObjectValid()) {

    var openParams = GetOpenDefaultParams ();

    var i = GetPropIndex(openParams, Constants.FS_UpdateXRefs);

    openParams.propVal.ival = Constants.FV_DoOK;

    var doc = Open(comp.Name, openParams, new PropVals());

    doc.PDFBookmark = true;

    doc.DocAcrobatElements = false;

    comp = comp.NextBookComponentInDFSOrder;

}   

var params = GetSaveDefaultParams();

var index = GetPropIndex(params, Constants.FS_FileType);

params[index].propVal.ival = Constants.FV_SaveFmtPdf;

var pdfDocInfo = new Strings();

pdfDocInfo.push("Author");

pdfDocInfo.push("XXX GmbH");

book.PDFDocInfo = pdfDocInfo;

book.Save(pdfPath, params, new PropVals());

I checked the value of "comp.FirstPageNum" for all the components. The value for the first component with a chapter is "1" as it should be.

Best regards,

Fabian

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

Hi Fabian,

Here is an example of the output from my PageLabeler script.

/pdfmark where { pop} { userdict /pdfmark /cleartomark load put} ifelse

[ {Catalog} << /PageLabels << /Nums [

0 << /S  /r  /St 1 /P () >>

1 << /S  /r  /St 2 /P () >>

2 << /S  /D  /St 1 /P (1-) >>

] >> >> /PUT pdfmark

This goes into a PostScript text frame on the first body page of the last component in the book. Each line starting with 03 represents the page numbering for each of the components in the book. The required syntax is documented in Adobe's pdfmark Reference manual. The site license version of my PageLabeler script includes the source code and you may be able to integrate it into your own process.

-Rick

TOPICS
Scripting

Views

376

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 26, 2018 0
Adobe Community Professional ,
Jun 26, 2018

Copy link to clipboard

Copied

Hi Fabian,

Please see my PageLabeler script: http://www.frameexpert.com/store/

Rick

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 26, 2018 0
Explorer ,
Jun 26, 2018

Copy link to clipboard

Copied

Hi Rick,

Thank you for answering. Unfortunately, the documents are published on a server, I can't use something with a GUI.

Fabian -

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 26, 2018 0
Adobe Community Professional ,
Jun 26, 2018

Copy link to clipboard

Copied

Hi Fabian,

The method PageLabeler uses is inserting pdfmark codes in a small Postscript text frame. This method could be modified so that it doesn't require the GUI interface. Please contact me offlist if you are interested in exploring this. Thank you very much.

rick at frameexpert dot com

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 26, 2018 1
Adobe Community Professional ,
Jun 28, 2018

Copy link to clipboard

Copied

Hi Fabian,

Here is an example of the output from my PageLabeler script.

/pdfmark where { pop} { userdict /pdfmark /cleartomark load put} ifelse

[ {Catalog} << /PageLabels << /Nums [

0 << /S  /r  /St 1 /P () >>

1 << /S  /r  /St 2 /P () >>

2 << /S  /D  /St 1 /P (1-) >>

] >> >> /PUT pdfmark

This goes into a PostScript text frame on the first body page of the last component in the book. Each line starting with 03 represents the page numbering for each of the components in the book. The required syntax is documented in Adobe's pdfmark Reference manual. The site license version of my PageLabeler script includes the source code and you may be able to integrate it into your own process.

-Rick

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2018 0