Adobe 23102480 Scripting Guide - Page 28
JavaScript Tools Guide, The ExtendScript
UPC - 883919080222
View all Adobe 23102480 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 28 highlights
Adobe Photoshop CS3 Scripting Guide Photoshop CS3 Scripting Photoshop CS3 28 VBS Dim appRef Set appRef = CreateObject("Photoshop.Application") 'Remember unit settings and set to values expected by this script Dim originalRulerUnits originalRulerUnits = appRef.Preferences.RulerUnits appRef.Preferences.RulerUnits = 1 'value of 1 = psPixels 'Create a PDF option object Dim pdfOpenOptionsRef Set pdfOpenOptionsRef = CreateObject("Photoshop.PDFOpenOptions") pdfOpenOptionsRef.AntiAlias = True pdfOpenOptionsRef.Height = 100 pdfOpenOptionsRef.Width = 200 pdfOpenOptionsRef.Mode = 2 ' psOpenRGB pdfOpenOptionsRef.Resolution = 72 pdfOpenOptionsRef.Page = 3 pdfOpenOptionsRef.ConstrainProportions = False ' open the file Dim docRef Set docRef = appRef.Open("C:\\PDFFiles\MyFile.pdf", pdfOpenOptionsRef) 'Restore unit setting appRef.Preferences.RulerUnits = originalRulerUnits JS Note: The ExtendScript File object expects Universal Resource Identifier (URI) notation. Please see the JavaScript Tools Guide for more information. // 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("/c/pdffiles/myfile.pdf") // Create a PDF option object var pdfOpenOptions = new PDFOpenOptions pdfOpenOptions.antiAlias = true pdfOpenOptions.height = 100 pdfOpenOptions.width = 200 pdfOpenOptions.mode = OpenDocumentMode.RGB pdfOpenOptions.resolution = 72 pdfOpenOptions.page = 3 pdfOpenOptions.constrainProportions = false // open the file app.open( fileRef, pdfOpenOptions ) // restore unit settings app.preferences.rulerUnits = originalRulerUnits