Copy link to clipboard
Copied
This is my Framemaker book to 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);
}
When I execute this function Framemaker opens the Adobe PDF Distiller which then creates the PDF.
However if I am doing this process manually I open the book go to the File menu and select "Save as PDF". Using this method Framemaker does not launch the Distiller, it creates the pdf without using any external application. This generates PDFs much faster.
Is there any way to access the second method of PDF generation using the ESTK?
Copy link to clipboard
Copied
Try adding this:
i = GetPropIndex (saveParams, Constants.FS_PDFUseDistiller);
saveParams.propVal.ival = 0;
Copy link to clipboard
Copied
That save parameter does make it so that the distiller is not visible, but it uses the same process so the distiller is probably just running in the background.
Also I could not find any documentation on this save parameter in the scripting guide. Latest version I can find is 2017.
I have 2 problems with the script driven pdf generation.
One is that when my PDF function is complete it leaves one of the book components open. For some reason I cannot access this component using app.ActiveDoc in order to get rid of it.
The second problem is that when PDFing some books, this function will cause Framemaker to crash with Internal Error 15014. These books always crash when using the script and never crash when manually PDFing from the file menu.
Is there maybe an FCode way to trigger the file menu "Save As PDF"?
Copy link to clipboard
Copied
Also what is the FM Publisher you reference in this thread?
Re: How can i use the FS_PDFUseDistiller porperty ? And how can i set the STS file?
Copy link to clipboard
Copied
That refers to using ExtendScript (or the FDK) to access the File > Publish command. One of the parameters listed specifies the sts file.
Copy link to clipboard
Copied
This is the solution.
using:
CallClient ("FMPublisher", "SetOutputLocation " + savePath);
CallClient ("FMPublisher", "MCPPublish PDF");
Accomplishes the same thing a the file menu "Save As PDF", which is just a shortcut to using the publisher menu and selecting PDF output with the default .sts file.
No more crashes and no more rogue book components.
Copy link to clipboard
Copied
And you can add this to set a specific sts file:
CallClient ("FMPublisher", "SetMCPSetting yourstsfile.sts");
Copy link to clipboard
Copied
Is there a way to call the publisher on a specific file rather other than the active book?
Copy link to clipboard
Copied
I think it only works on the active document or book, so you would have to open the document and make sure it is active (in front) when you invoke the CallClient method calls.