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

Save FM Book as PDF: Set ElementBoundaryDisplay

New Here ,
May 13, 2019 May 13, 2019

Copy link to clipboard

Copied

I am working on a script to save multiple framemaker book files as PDFs.  The books successfully save to PDF, but the element boundaries are displayed as tags in the pdf.

I have tired both:

app.ActiveDoc.ElementBoundaryDisplay = 0

and

app.ActiveBook.ElementBoundaryDisplay = 0

while the book is open in Framemaker.  Neither work.

This is my PDF saving function:

function saveToPDF(fileObject, savePath) { 

    var saveParams, i;

    saveParams= GetSaveDefaultParams(); 

   

    i = GetPropIndex(saveParams, Constants.FS_FileType); 

    saveParams.propVal.ival = Constants.FV_SaveFmtPdf;

   

    var saveAsName = savePath; 

    var returnParamsp = new PropVals(); 

    fileObject.Save(saveAsName, saveParams, returnParamsp); 

Any ideas on how to make sure element boundary display is turned off in an active book?

TOPICS
Scripting

Views

1.5K

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
Advocate ,
May 13, 2019 May 13, 2019

Copy link to clipboard

Copied

You will have to cycle through the book components, set the element boundaries off, and save the document before retrying the save book to PDF.

I never ever have element boundaries showing in FrameMaker, as that messes up your display as well as the pagination. I use the Structure View to navigate and see where I am, not the boundaries or tags in the middle of the text.

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
Mentor ,
May 14, 2019 May 14, 2019

Copy link to clipboard

Copied

I have the same question and have had it ever since the boundary display became "global." I cannot change the boundary display with ExtendScript or the FDK, where previously it worked seamlessly. None of the following commands do anything:

app.ActiveDoc.ElementBoundaryDisplay = 0;

app.ActiveDoc.ElementBoundaryDisplay = Constants.FV_ELEM_DISP_NONE;

app.ActiveDoc.ElementBoundaryDisplay = Constants.FV_ELEM_DISP_BRACKETS;

app.ActiveDoc.ElementBoundaryDisplay = Constants.FV_ELEM_DISP_TAGS;

Russ

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
Advocate ,
May 14, 2019 May 14, 2019

Copy link to clipboard

Copied

Have you tried executing the Fcode for the menu command ?

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
Mentor ,
May 15, 2019 May 15, 2019

Copy link to clipboard

Copied

Jang, thanks for the idea. It does work, although it is a little bit odd.

The fcodes work with a toggle action. This code will toggle brackets on and off:

Fcodes([FCodes.KBD_ELEM_BORDER]);

This code will toggle tags on and off:

Fcodes([FCodes.KBD_ELEM_TAGS]);

But the problem with FCodes alone is that they are a simple toggle and you don't know the current state of the display. Fortunately, although setting ElementBoundaryDisplay does not work, I am able to read it. So I came up with the following function that seems to be a workaround:

// For setting, send one of:

// Constants.FV_ELEM_DISP_NONE

// Constants.FV_ELEM_DISP_BRACKETS

// Constants..FV_ELEM_DISP_TAGS

function setElemBoundaryDisplay(doc, setting)

{

    //If the doc is invalid, return

    if(!doc.ObjectValid()) return;

   

    //If there is nothing to change, just return

    if(doc.ElementBoundaryDisplay == setting) return;

   

    //If we are turning off, we need to first see what is

    //turned on, so we know how to turn off.

    if(setting == Constants.FV_ELEM_DISP_NONE)

    {

        if(doc.ElementBoundaryDisplay == Constants.FV_ELEM_DISP_BRACKETS)

          Fcodes([FCodes.KBD_ELEM_BORDER]);

        else

          Fcodes([FCodes.KBD_ELEM_TAGS]);

    }

   

    //Otherwise, if we are setting brackets...

    else if(setting == Constants.FV_ELEM_DISP_BRACKETS)

      Fcodes([FCodes.KBD_ELEM_BORDER]);

   

    //Otherwise, if we are setting tags...

    else

      Fcodes([FCodes.KBD_ELEM_TAGS]);

}

It would be much nicer if it actually just worked. By the way, there are other FCodes in the doc and fcodes.h that seem to be decoys... don't know what they are for:

#define KBD_SHOW_ELEM_BORDER   0x3F6
#define KBD_SHOW_ELEM_TAGS   0x3F7

Russ

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
Advocate ,
May 15, 2019 May 15, 2019

Copy link to clipboard

Copied

LATEST

Yes, that looks like a decent approach. What the other Fcode values mean I do not know. They might be historical values so they would not do anything anymore. Or they might just do the same thing.

4everJang

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