Copy link to clipboard
Copied
Hi there,
Long-time reader, first time poster... I'm working on a javascript to have Photoshop open a PDF and save pages as different kinds of images for various purposes and have hit a roadblock, a TIFFSaveOptions does not have a constructor error. I'm building this code out bit by bit, and enjoying the experience but I'm not sure what this error is actually telling me or how to work through it. Here's the code, any insights would be greatly appreciated. Thank you!
// Set the ruler units to pixels
var originalRulerUnits=app.preferences.rulerUnits;
app.preferences.rulerUnits=Units.PIXELS;
//get a reference to the file that we want to open
var fileRef=new File(app.openDialog ());
//Creat a PDF option object
var pageIndex=1;
while(pageIndex !== "undefined"){
var pdfOpenOptions=new PDFOpenOptions;
pdfOpenOptions.antiAlias=true;
pdfOpenOptions.mode=OpenDocumentMode.CMYK;
pdfOpenOptions.resolution=300;
PDFOpenOptions.page=pageIndex;
// open the file
app.open(fileRef,pdfOpenOptions);
// save result as spread_printCMYK.tif
printCMYKFile=new File ("/testspread_printCMYK.tif");
tiffSaveOptions=new TIFFSaveOptions();
tiffSaveOptions.byteOrder=ByteOrder.MACOS;
tiffSaveOptions.layers=false;
app.activeDocument.saveAs(printCMYKFile,tiffSaveOptions,true,Extension.LOWERCASE);
// resize image to 72 dpi and convert to RGB
screenRGBFile=new File ("/testspread_screenRGB.jpg");
activeDocument.resizeImage (undefined, undefined, 72, ResampleMethod.NONE);
activeDocument.changeMode(ChangeMode.RGB);
pageIndex++;
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
Hi @PWMarkowski , Should be
var tiffSaveOptions = new TiffSaveOptions()
//not var tiffSaveOptions = new TIFFSaveOptions()
Copy link to clipboard
Copied
Hi @PWMarkowski , Should be
var tiffSaveOptions = new TiffSaveOptions()
//not var tiffSaveOptions = new TIFFSaveOptions()
Copy link to clipboard
Copied
Thank you! JS is VERY case sensitive!
Copy link to clipboard
Copied
I marked the reply from @rob day as correct, one has to keep in mind that JS is case-sensitive.
https://theiviaxx.github.io/photoshop-docs/Photoshop/TiffSaveOptions.html