Copy link to clipboard
Copied
Hi all,
I use a javascript that exports 2 or 3 flavors of pdf. Works great. I'd like to add an alert that flags any linked rgb file (tiff). And if clear, will just pass to the next process. So alerts if RGBs linked, no alert if CMYKs are linked.
Below is what I have, but it always says that there is no RGB, whether or not rgb is linked.
Thanks for the suggestion to convert all to a prescribed cmyk. However, clients and pubs all have specific profiles that would require many more
job options and the potential for mismatch. Yes our artist should look for errors in the pre flyt but this script would act as a safety.
if I get something to work I'll post the code and you all can give it a try. The export various PDFs routine is a real time saver.
So the CMYK files get saved with no embedded profile, and the InDesign PDF Export Color Conversion is set to No Conversion? Do your retouch artists make color corrections after the conversion to CMYK?
Can you post the full script?
All the CMYK images are tagged, and yes the job options are set to No Conversion. Here's the scriot as it stands. You will need to replace preset1-3 with joboptions within your export sets. There is a spot at the top of the code that I commented out indicating where the "break" might go?
Copy link to clipboard
Copied
Hi @RoyBoySolorio , If you want your PDF to Export as all CMYK, why not simply set the Export>Output Destination to a CMYK profile? That would convert all RGB color to CMYK in the exported PDF.
On your code, if I comment out the try in your runShellCommand function I always get an error—Process does not have a constructor. So colorProfileInfo is always returning null.
A more reliable approach might be to check for RGB color using InDesign’s preflightProfile object.
Copy link to clipboard
Copied
Thanks for the suggestion to convert all to a prescribed cmyk. However, clients and pubs all have specific profiles that would require many more
job options and the potential for mismatch. Yes our artist should look for errors in the pre flyt but this script would act as a safety.
if I get something to work I'll post the code and you all can give it a try. The export various PDFs routine is a real time saver.
Copy link to clipboard
Copied
all have specific profiles that would require many more job options
The conversion to CMYK should always be to Document CMYK—the PDF/X-1a default. You wouldn’t want to find an RGB image and convert it to a conflicting CMYK profile in Photoshop, so the Destination would always be DocumentCMYK.
Try this preflight function. It will check for any RGB color:
if (checkForRGB()) {
alert("Document contains RGB color")
} else {
alert("No RGB color")
}
/**
* Checks Document for RGB Color
* @ return true if RGB objects are found
*
*/
function checkForRGB(){
var d = app.activeDocument
//Make a new Preflight Profile
var pf = makePreflight("TestNoRGB");
var cs = makeRule(pf, "ADBE_Colorspace")
cs.flag = PreflightRuleFlag.returnAsError;
var csNoRGB = cs.ruleDataObjects.itemByName("no_rgb")
csNoRGB.properties = {dataType:RuleDataType.BOOLEAN_DATA_TYPE, dataValue:true}
d.preflightOptions.preflightOff = false;
d.preflightOptions.preflightWorkingProfile = pf;
var pfp = app.preflightProcesses.add(d, pf)
pfp.waitForProcess();
if (pfp.processResults.length > 6) {
return true
} else {
return false
}
}
/**
* Makes a new Preflight
* @ param preflight name
* @ return the new preflight
*/
function makePreflight(n){
if (app.preflightProfiles.itemByName(n).isValid) {
return app.preflightProfiles.itemByName(n);
} else {
return app.preflightProfiles.add({name:n});
}
}
/**
* Makes a new Preflight Rule
* @ param preflight name
* @ param the preflight rule constant name
* @ return the new preflight rule
*/
function makeRule(pf, n){
if (pf.preflightProfileRules.itemByName(n).isValid) {
return pf.preflightProfileRules.itemByName(n);
} else {
return pf.preflightProfileRules.add(n);
}
}
Copy link to clipboard
Copied
rob day, this works great. Is there a way to "break" in the script or exit the script after the rgb error dialog box is closed?
Copy link to clipboard
Copied
The checkForRGB() function returns true or false, so you don’t need the alerts. I assume if there is no RGB color you want to make a PDF? So you can check if checkForRGB() returns as false (no RGB color) and add your PDF routine. if it returns true you can throw up a dialog and the script ends.
if (!checkForRGB()) {
//Add function for the Export here
} else {
alert("There’s RGB Color Now What?")
}
What will you do if there are RGB images? Open the images into Photoshop and convert to CMYK? What profile will you convert to?
Copy link to clipboard
Copied
Glad to elaborate,
Maybe this is unorthodox, no judging, we manage all CMYK within the Retouching department. The Assembly artists just push managed images through for loose color. News, 280, 300, 320dmax, spec'd CMYK or Greyscale goes unaltered, into the PDF. We have an epson rip that errors when an RGB is linked, but on rare occasions RGB will get through, converting in the rip, with odd effects. Mostly bad and obvious.
The other chore creates 3 pdfs from the same mechanical, a High, Medium and Low res PDF for various needs. We have an InDesign script that performs that, calling on the various joboptions, which creates the 3 pdfs. All good.
What your script does is, prior to making the pdfs, evals the doc and throws out the warning/alert when RGB is detected. But when the alert panel is closed, it wants to continue with making the pdfs.
I can cancel, which is ineligant with a scarry javascript error, but I would perfer that once the warning panel is closed, just returns to the doc, where the artist updates the link and restarts the script.
What do you think?
Copy link to clipboard
Copied
So the CMYK files get saved with no embedded profile, and the InDesign PDF Export Color Conversion is set to No Conversion? Do your retouch artists make color corrections after the conversion to CMYK?
Can you post the full script?
Copy link to clipboard
Copied
All the CMYK images are tagged, and yes the job options are set to No Conversion. Here's the scriot as it stands. You will need to replace preset1-3 with joboptions within your export sets. There is a spot at the top of the code that I commented out indicating where the "break" might go?
Copy link to clipboard
Copied
This works. Solved thanks so much for the great help.
Copy link to clipboard
Copied
The full workflow has InDesign set to not color manage.
Copy link to clipboard
Copied
That would cause problems with RGB objects.
Copy link to clipboard
Copied
We don't use an RGB workflow. Thanks again rob day. That bit of script was just what I needed.
Copy link to clipboard
Copied
All the CMYK images are tagged, and yes the job options are set to No Conversion.
If the placed CMYK images are tagged, does the InDesign document get the same CMYK assignment? Seems like you run the risk of conflicting CMYK profiles in the same document.
Here's the scriot as it stands.
The other way to do it is wrap your export code in a function and call it in the if statement:
//If checkForRGB returns false (!) there is no RGB color, so run exportPDFs() function
if (!checkForRGB()) {
exportPDFs()
} else {
alert("Document contains RGB color, No PDFs were exported");
}
/**
BS"D
All rights reserved (c) 2015 by Id-Extras.com
Free to use and modify but do not delete this copyright attribution.
This script will export 2 pdfs of the current document
Choose the PDF presets by altering their names below
The second PDF gets a suffix added to its name.
Modify the line below beginning name2 = to change the suffix.
For more InDesign scripts: www.Id-Extras.com
XYZ modified for 3 type pdfs...also holds all characters but removes .indd
* @ return void
*/
function exportPDFs(){
var d = app.activeDocument;
var thePath;
// Here you can choose the PDF preset
var preset1 = app.pdfExportPresets.itemByName("HiRes_joboption");
var preset2 = app.pdfExportPresets.itemByName("MedRes_joboption");
var preset3 = app.pdfExportPresets.itemByName("LoRes_joboption");
if (!(preset1.isValid)){
alert("One of the presets does not exist. Please go to Vol1-Photoshop_Illustrator_InDesign_Acrobat_Stuff/AcrobatJobOptions_B/for actions, and load them into your setting folder");
exit();
}
if (d.saved){
thePath = String(d.fullName).replace(".indd", "") + ".pdf";
thePath = String(new File(thePath).saveDlg());
}else{
thePath = String((new File).saveDlg());
}
thePath = thePath.replace(/\.pdf$/, "");
var name1 = thePath+".pdf";
// Here you can set the suffix at the end of the name
var name2 = thePath+"_MR.pdf";
var name3 = thePath+"_LR.pdf";
d.exportFile(ExportFormat.PDF_TYPE, new File(name1), false, preset1);
d.exportFile(ExportFormat.PDF_TYPE, new File(name2), false, preset2);
d.exportFile(ExportFormat.PDF_TYPE, new File(name3), false, preset3);
}
/**
* Checks Document for RGB Color
* @ return true if RGB objects are found
*/
function checkForRGB(){
var d = app.activeDocument
//Make a new Preflight Profile
var pf = makePreflight("TestNoRGB");
var cs = makeRule(pf, "ADBE_Colorspace")
cs.flag = PreflightRuleFlag.returnAsError;
var csNoRGB = cs.ruleDataObjects.itemByName("no_rgb")
csNoRGB.properties = {dataType:RuleDataType.BOOLEAN_DATA_TYPE, dataValue:true}
d.preflightOptions.preflightOff = false;
d.preflightOptions.preflightWorkingProfile = pf;
var pfp = app.preflightProcesses.add(d, pf)
pfp.waitForProcess();
if (pfp.processResults.length > 6) {
return true
} else {
return false
}
}
/**
* Makes a new Preflight
* @ param preflight name
* @ return the new preflight
*/
function makePreflight(n){
if (app.preflightProfiles.itemByName(n).isValid) {
return app.preflightProfiles.itemByName(n);
} else {
return app.preflightProfiles.add({name:n});
}
}
/**
* Makes a new Preflight Rule
* @ param preflight name
* @ param the preflight rule constant name
* @ return the new preflight rule
*/
function makeRule(pf, n){
if (pf.preflightProfileRules.itemByName(n).isValid) {
return pf.preflightProfileRules.itemByName(n);
} else {
return pf.preflightProfileRules.add(n);
}
}
Copy link to clipboard
Copied
I don't now if my response it's stupid....why don't you see in the links pannel if there is a rgb image?
Copy link to clipboard
Copied
I think Rob has the solution, but I'm going to tweak it to pass to the pdf generation without the "No RGB" alert.
Copy link to clipboard
Copied
I don't now if my response it's stupid....why don't you see in the links pannel if there is a rgb image?
That’s a good question, but a link could be a PDF or AI file, which could have a mix of any number of RGB, CMYK, or Lab objects. And what about native RGB colors and swatches? Why would image RGB be a problem and native or PDF RGB objects be OK?
Also, not sure if this helps @RoyBoySolorio , but a PDF .joboptions could have the Output Destination set DocumentCMYK—the Destination would always be the document’s assigned CMYK profile, so there would be no need for multiple .joboptions.
You would never want to place CMYK images and then Export to a conflicting CMYK space—that would defeat the purpose of making the CMYK conversions before placing the links.
Here the preset X4 DocCMYK has its Destination set to DocumentCMYK:
The preset picks up the document’s CMYK assignment and always uses it as the Destination without modifying the .joboptions
Copy link to clipboard
Copied
Yep easy, until it's missed in the hurry of getting a proof out. This just short circuits that potential.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more