Adobe 65048332 Manual page 30

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER
The document will open to page 3.
The document's original shape will change to conform to the height and width properties if the
original shape is not twice as wide as it is tall.
AS
tell application "Adobe Photoshop CS5"
set myFilePath to alias "OS X 10.5.8 US:Users:psauto:Desktop:opal_screen.pdf"
with timeout of 300 seconds
open myFilePath as PDF with options ¬
end timeout
end tell
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.Mode = 2 ' psOpenRGB
pdfOpenOptionsRef.Resolution = 72
pdfOpenOptionsRef.Page = 3
' open the file
Dim docRef
Set docRef = appRef.Open("C:\\PDFFiles\MyFile.pdf", pdfOpenOptionsRef)
'Restore unit setting
appRef.Preferences.RulerUnits = originalRulerUnits
JS
N
: The ExtendScript
OTE
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.mode = OpenDocumentMode.RGB
pdfOpenOptions.resolution = 72
pdfOpenOptions.page = 3
// open the file
app.open( fileRef, pdfOpenOptions )
// restore unit settings
app.preferences.rulerUnits = originalRulerUnits
{class:PDF open options, ¬
mode:RGB, resolution:72, use antialias:true, page:3}
object expects Universal Resource Identifier (URI) notation. Please see the
File
Opening a Document 30

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents