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

Photoshop javascript throwing TIFFSaveOptions does not have a constructor error

New Here ,
Nov 21, 2022 Nov 21, 2022

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);
}

 

TOPICS
Actions and scripting

Views

768

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Nov 21, 2022 Nov 21, 2022

Hi @PWMarkowski , Should be

var tiffSaveOptions = new TiffSaveOptions()
//not var tiffSaveOptions = new TIFFSaveOptions()

 

Likes

Translate

Translate
Community Expert ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Hi @PWMarkowski , Should be

var tiffSaveOptions = new TiffSaveOptions()
//not var tiffSaveOptions = new TIFFSaveOptions()

 

Likes

Translate

Translate

Report

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
New Here ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

LATEST

Thank you!  JS is VERY case sensitive!

Likes

Translate

Translate

Report

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 ,
Nov 21, 2022 Nov 21, 2022

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

Likes

Translate

Translate

Report

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