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

DITA PDF Bookmarks when publish by script are not set correctly

Community Beginner ,
Sep 26, 2023 Sep 26, 2023

Copy link to clipboard

Copied

I'm running publishing process to PDF for a DITA Map by script (FDK client) in FrameMaker 2022. I'm going the book way, as I need TOC and a title page!

When running pulishing by double clicking PDF icon in publishing dialog all works well and bookmarks are correct in PDF!

When running publishing process via CallClient, PDF bookmark settings are not updated in book, and therefore all elements are creating a bookmark not the one that are defined in templates...

 

I tried to catch event FA_Note_PostOpenBook to update PDF settings in Book programmatically after book is opened. But this event is not fired. 

Any idea how I can fix this? Is there a book template in installation where I can change defaults? Anything which helps me doing this programmatically would help me. 

Thanks in advance

Markus

TOPICS
Error , PDF output , Publishing , Scripting , Structured

Views

479

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

correct answers 2 Correct answers

Community Expert , Sep 26, 2023 Sep 26, 2023

Hi Markus,

I have had similar issues for some clients. I found that I have to programmatically set the bookmark levels throughout all of the components in the book before it gets saved to PDF. I use a simple XML file to determine the levels:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
    <bookmarkLevels>
        <format name="ctoc.appendix.number" level="1"/>
        <format name="ctoc.chapter.number" level="1"/>
        <format name="title.0" level="2"/>
        <format name="title.0.fro
...

Votes

Translate

Translate
Community Expert , Sep 26, 2023 Sep 26, 2023

I am using this notification:

Notification (Constants.FA_Note_PostPublishDitamap, true);

because I am publishing a ditamap.

Votes

Translate

Translate
Community Expert ,
Sep 26, 2023 Sep 26, 2023

Copy link to clipboard

Copied

Hi Markus,

I have had similar issues for some clients. I found that I have to programmatically set the bookmark levels throughout all of the components in the book before it gets saved to PDF. I use a simple XML file to determine the levels:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
    <bookmarkLevels>
        <format name="ctoc.appendix.number" level="1"/>
        <format name="ctoc.chapter.number" level="1"/>
        <format name="title.0" level="2"/>
        <format name="title.0.frontmatter" level="2"/>
        <format name="title.1" level="3"/>
        <format name="title.2" level="4"/>
        <format name="title.3" level="5"/>
        <format name="title.4" level="6"/>
        <format name="title.a" level="2"/>
    </bookmarkLevels>
</settings>

Then I have a function that sets the bookmark levels on each paragraph format in each document:

AA_SBL.processDoc = function (doc, xml) {
    
    var pgffmt, level;
    
    if (app.Displaying == 1) {
        app.Displaying = 0;
    }

    pgffmt = doc.FirstPgfFmtInDoc;
    while (pgffmt.ObjectValid () === 1) {
        level = String (xml.format.(@name == pgffmt.Name).@level);
        if (level !== "") {
            pgffmt.AcrobatLevel = Number (level);
        }
        else {
            pgffmt.AcrobatLevel = 0;
        }
        pgffmt = pgffmt.NextPgfFmtInDoc;
    }	
	
    if (app.Displaying == 0) {
        app.Displaying = 1;
        doc.Redisplay();
    }
};

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
Community Beginner ,
Sep 26, 2023 Sep 26, 2023

Copy link to clipboard

Copied

@frameexpert thank you for confirming this issue and the sample... What is the trigger you use? As this FM Book is generated temporarily in PDF generation process I hoped I could use Notify event when book is opened in FM, but my FDK client didn't get this event.... 

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
Community Expert ,
Sep 26, 2023 Sep 26, 2023

Copy link to clipboard

Copied

I am using this notification:

Notification (Constants.FA_Note_PostPublishDitamap, true);

because I am publishing a ditamap.

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
Community Beginner ,
Sep 26, 2023 Sep 26, 2023

Copy link to clipboard

Copied

This is what I didn't expected - publishing is finished when PDF is done 🙂 Hahaha

And I need to write a script which does this job, as this event is not send back to calling FDK client.

thanks @frameexpert for your support

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
Community Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

@frameexpert this works with paragraph bookmarks, very well. any idea on how to do this with element level bookmarks "title(Level1)"? Seems the issue is title and toc page which has no structured content?

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
Community Expert ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

I haven't encountered this situation Markus so I am not sure. Can you import element definitions into your unstructured title page without messing up it's formatting?

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
Community Expert ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

How do you set element bookmarks programmatically?

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
Community Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

that's good question and so annoying... 

Tried to import PDF Settings from last document in book to book itself... when catching event PreSaveBook...

No changes so far... I have the settings set in title page, EDD is in but of course no root... will try to add a dita element

 

Thanks so far Rick.

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
Community Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

doing this by hand within the book itself, does the job, but not in this publishing scenario... let's see. there will be a way 🙂

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
Community Expert ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

I have been looking around the FDK docs, but can't see any properties for setting this.

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
Community Expert ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

Can you post a screenshot of how you are setting the bookmarks in the interface? Thanks.

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
Community Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

That's the way it works programmatically (outside of publishing)

            doc.doc.DocAcrobatElements=1;
            this.book.DocAcrobatElements=1;
            this.book.DocAcrobatElementList = doc.doc.DocAcrobatElementList;

 

Otherwise here in UI

MarkusWiedenmaier_0-1697633380299.png

 

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
Community Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

LATEST

OK. this is really strange... when I save the book after PostPublishDitaMap Event and call publish Book Bookmarks are right, but not in this DITAMap publishing process

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