• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Wrong bookmarks when saving PDF through a script

Explorer ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

Hello,

 

I am in the process of creating a script to automatize exporting applications with variants (contitional text + variables) to pdf.

 

I have tried to use 2 different methods but they both lead to wrong bookmarks, as shown below, screenshot from Acrobat Reader:

Eric5F88_0-1669632189476.png

<GRAPHIC> shouldn't appear here, but somehow it does.

 

I have tried changing the book and documents settings using menu "format > document > pdf setup" but nothing seems to have an effet.

 

Those are the methods:

  • Method 1:

 

 

params = GetSaveDefaultParams ();
returnParams = new PropVals ();
    
params[GetPropIndex (params, Constants.FS_FileType)].propVal.ival = Constants.FV_SaveFmtPdf;
params[GetPropIndex (params, Constants.FS_PDFUseDistiller)].propVal.ival = 1;

FA_errno = 0;
book.BookIsSelected = 1;
book.Save(projectBasePath + pdfNamePrefix + tag + startDate + pdfNameSuffix, params, returnParams);

 

 

 

  • Method 2:

 

 

CallClient("FMPublisher", "SetOutputLocation " + projectBasePath + pdfNamePrefix + tag + startDate + pdfNameSuffix);
CallClient("FMPublisher", "MCPPublish PDF");

 

 

 

Both methods lead to the result above.

 

However when I manually export the pdf by selecting the book and use manu "file > save as pdf...", the bookmark show as expected:

Eric5F88_1-1669634106348.png

Those are the "format > documents > pdf setup" settings that work fine when doing the export to pdf manually:

Eric5F88_2-1669634207574.png

 

Where can I configure the bookmarks for it being taken into account when exporting with a script ?

 

Thanks in advance.

 

Best regards

 

Eric

Views

111

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
community guidelines
Community Expert ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

LATEST

Try turning this document property off for each document in the book:

 

// Assuming doc is your Doc object.
doc.DocAcrobatElements = 0;

 

For each paragraph format in the document, you set its AcrobatLevel property to the desired level. Use 0 (zero) for paragraph formats that you don't want to include. So yours would be:

 

// Assuming pgfFmt is your paragraph format object.
// Don't include as a bookmark:
pgfFmt.AcrobatLevel = 0;
// Heading1
pgfFmt.AcrobatLevel = 1;
// Heading2
pgfFmt.AcrobatLevel = 2;
// Heading3
pgfFmt.AcrobatLevel = 3;

 

Votes

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
community guidelines