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

Saving a review PDF

New Here ,
Apr 01, 2015 Apr 01, 2015

Copy link to clipboard

Copied

Hi all,

I'm just getting into Extendscript for FM 12 so bear with me.

I have found the FM_Outputs_CondText file which does everything I need it to do except for I want the file to be saved as a review PDF. I've found the FCodes.KBD_SAVEASPDFREVIEW command and can get it to open the saveas dialog. However, I cannot for the life of me figure out how to interact with this. Any thoughts on how I can achieve the following process:

1: Apply conditional text show/hide (included in FM_Outputs_CondText)

2: Change output file name (depends on how I achieve step 3)

3: Save as review pdf

4: Move to next conditional text show/hide (included in FM_Outputs_CondText)

Any suggestions of what to do or where to look would be amazing.

(any FM scripter/user groups in Portland, OR?)

---Corey---

TOPICS
Scripting

Views

829

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 1 Correct answer

Community Expert , Apr 01, 2015 Apr 01, 2015

Hi Corey,

I don't have time to give you a detailed explanation, but here is some code to get you going on saving a review PDF.

#target framemaker

var doc = app.ActiveDoc;

savePdf (doc);

function savePdf (doc) {

   

    var saveParams, retParams, i = 0, pdfName;

   

     // Get a property list to return any error messages.

    retProps = new PropVals();

   

    saveProps = GetSaveDefaultParams();

    i = GetPropIndex (saveProps, Constants.FS_FileType);

    saveProps.propVal.ival = Constants.F

...

Votes

Translate

Translate
Community Expert ,
Apr 01, 2015 Apr 01, 2015

Copy link to clipboard

Copied

Hi Corey,

I don't have time to give you a detailed explanation, but here is some code to get you going on saving a review PDF.

#target framemaker

var doc = app.ActiveDoc;

savePdf (doc);

function savePdf (doc) {

   

    var saveParams, retParams, i = 0, pdfName;

   

     // Get a property list to return any error messages.

    retProps = new PropVals();

   

    saveProps = GetSaveDefaultParams();

    i = GetPropIndex (saveProps, Constants.FS_FileType);

    saveProps.propVal.ival = Constants.FV_SaveFmtPdf;

   

    doc.PDFJobOption = "Standard";

    doc.PDFGenerateForReview = 1;

       

    // Get the save name for the PDF and save it.

    pdfName = doc.Name.replace (/\.fm/i, ".pdf");

    doc.Save (pdfName, saveProps, retProps);

}

-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 Expert ,
Apr 01, 2015 Apr 01, 2015

Copy link to clipboard

Copied

A couple of things about the code: line 17 is where you can set the desired PDF Job Option file. I am not sure about line 19; I have never used this, but I am pretty sure this is the setting you are looking for to make a review PDF. Line 22 uses a regular expression to replace the .fm extension with .pdf.

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 ,
Apr 01, 2015 Apr 01, 2015

Copy link to clipboard

Copied

I just found the FM_Outputs_CondText.jsx that you are referring to. No offense to anyone at Adobe, but their code does not always reflect the best approach to doing things. If you need further help sorting this out, please post more questions to the forum. Thanks. -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
New Here ,
Apr 02, 2015 Apr 02, 2015

Copy link to clipboard

Copied

Hi Rick,

Thank you for the fast and detailed response. I knew it couldn't be THAT difficult to do what I wanted it to do, I'm just a amateur coder so it was not in my scope of knowledge yet. Your code worked exactly the way I wanted it to and I should be able to modify it from here to do what I want it to do. Now I just have a few other processes to figure out and I'm good to go (but they don't fit within this question so I'll post them elsewhere when I give up trying to figure it out myself). Thanks so much!

----Corey---

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 ,
Apr 02, 2015 Apr 02, 2015

Copy link to clipboard

Copied

Fantastic! I am glad it helped. Make sure you read this Scripting tips. It will help you as you learn. -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
New Here ,
Apr 02, 2015 Apr 02, 2015

Copy link to clipboard

Copied

LATEST

Thanks Rick,

I'll check it out.

---Corey---

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