Skip to main content
Markus Wiedenmaier
Inspiring
September 26, 2023
Answered

DITA PDF Bookmarks when publish by script are not set correctly

  • September 26, 2023
  • 1 reply
  • 1001 views

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

This topic has been closed for replies.
Correct answer frameexpert

I am using this notification:

Notification (Constants.FA_Note_PostPublishDitamap, true);

because I am publishing a ditamap.

1 reply

frameexpert
Community Expert
Community Expert
September 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.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();
    }
};
Markus Wiedenmaier
Inspiring
September 26, 2023

@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.... 

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
September 26, 2023

I am using this notification:

Notification (Constants.FA_Note_PostPublishDitamap, true);

because I am publishing a ditamap.