Skip to main content
mihail-cosminm61564092
Inspiring
June 28, 2024
Question

ExtendScript to Save FM to PDF with PDFConvertCMYKtoRGB not working correctly

  • June 28, 2024
  • 2 replies
  • 457 views

Hello,

I am trying to save a FM file to PDF from ExtendScript, but for some reason PDFConvertCMYKtoRGB doesn't work. The colors in the PDF produced are wrong. 
I have manually checked and the ConvertCMYKtoRGB is definitely the setting that affects the color issue. Manually disabling this setting in the interface and saving to PDF from the interface produces the same colors in the PDF as below script.

var doc = app.ActiveDoc;
var pdfName = doc.Name.replace(/\.fm$/, ".pdf");
 

var saveParams = GetSaveDefaultParams();
var saveReturnParams = new PropVals();

i = GetPropIndex(saveParams, Constants.FS_FileType);
saveParams[i].propVal.ival = Constants.FV_SaveFmtPdf;

 

i = GetPropIndex(saveParams, Constants.FS_PDFUseDistiller);
saveParams[i].propVal.ival = 0;  // 1 has correct colors, but shows distiller dialog

 

i = GetPropIndex(saveParams, Constants.FS_AlertUserAboutFailure);
saveParams[i].propVal.ival = 1;

 

i = GetPropIndex(saveParams, Constants.FS_FileIsInUse);
saveParams[i].propVal.ival = Constants.FV_ResetLockAndContinue;

 

i = GetPropIndex(saveParams, Constants.FS_SaveFileNotWritable);
saveParams[i].propVal.ival = Constants.FV_DoShowDialog;

 

doc.PDFConvertCMYKtoRGB = 1;
doc.PDFDistillerAbsent = 1;
doc.PDFJobOption = "High Quality Print";
doc.PDFBookmark = 1;
doc.PDFBookmarksOpenLevel = Constants.FV_PDFBookmarksOpenDefaultLevel;

 

docProps = doc.GetProps();

for (i = 0; i < docProps.length; i++) {
    // print props to check if  PDFConvertCMYKtoRGB is set to 1

    $.writeln(docProps[i].propIdent.num + " " + docProps[i].propVal.ival);
}

doc.Save(pdfName, saveParams, saveReturnParams);

doc.Close(0);


Anyone know why this doesn't work ?

This topic has been closed for replies.

2 replies

Bob_Niland
Community Expert
Community Expert
June 28, 2024

Color model conversions are almost never fully satisfactory, so I'm wondering what your criteria are.

If manually saving from FM to PDF is producing a different result than scripting the same thing, then there is clearly a software problem. Screenshots of the two outputs might be helpful in the troubleshooting here.

And is it all color images in any FM document, or just some file formats?

mihail-cosminm61564092
Inspiring
July 8, 2024

Hi, here you can see the difference in color. This happens for text front color.


So, if there is no problem with the script content, then it must be a bug in Framemaker and this feature does not work, right?

Jeff_Coatsworth
Community Expert
Community Expert
June 28, 2024

What version of FM are you trying this with? FM2022 patch4 has scripting issues I believe...

mihail-cosminm61564092
Inspiring
June 28, 2024

I have FM2022 patch 3:  17.0.3.546

Jeff_Coatsworth
Community Expert
Community Expert
June 28, 2024

OK, I'd stay on that version until the issues in patch 4 are worked out. Was this script working before & now it's not? Or has it never worked?