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

ExtendScript to Save FM to PDF with PDFConvertCMYKtoRGB not working correctly

Explorer ,
Jun 28, 2024 Jun 28, 2024

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 ?

TOPICS
PDF output , Publishing , Scripting
410
Translate
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 ,
Jun 28, 2024 Jun 28, 2024

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

Translate
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
Explorer ,
Jun 28, 2024 Jun 28, 2024

I have FM2022 patch 3:  17.0.3.546

Translate
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 ,
Jun 28, 2024 Jun 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?

Translate
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
Explorer ,
Jun 28, 2024 Jun 28, 2024

I just wrote it today for the first time. 
The saving to PDF works, just the colors are wrong.

Translate
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 ,
Jun 28, 2024 Jun 28, 2024

Well, part-way there! Maybe @frameexpert  will jump in. 😁

Translate
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 ,
Jun 28, 2024 Jun 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?

Translate
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
Explorer ,
Jul 07, 2024 Jul 07, 2024
LATEST

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

mihailcosminm61564092_0-1720419796677.png


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?

Translate
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