JavaScript API [callas Intranet] - Adobe Acrobat Engineering

JavaScript API [callas Intranet] - Adobe Acrobat Engineering JavaScript API [callas Intranet] - Adobe Acrobat Engineering

acroeng.adobe.com
from acroeng.adobe.com More from this publisher
10.04.2013 Views

JavaScript API [callas Intranet] JavaScript API This chapter is a complete reference to the Acrobat extensions to JavaScript, its objects, methods, and properties. The chapter is organized alphabetically by object name. Doc Preflight adds one method to the Acrobat Doc object allowing to preflight the document. Doc methods preflight 9.0 D P Runs a Preflight profile for the document. An exception is thrown if the Preflight run fails. Parameters oProfile The Preflight profile to be used for the Preflight run, described by a PreflightProfile object. bOmitFixups (optional) Omit all fixups in the Preflight profile. If bOmitFixups is not specified, false is used. oThermometer Returns A PreflightResult object. Example http://10.0.0.26/doku.php?id=development:oyster:specs:preflightapi:javascript 10/31/2007 04:32 PM (optional) Show status window and progress bar that indicates to the user that a lengthy operation is in progress. To acquire a Thermometer object, use app.thermometer. If oThermometer is not specified, no progress is shown. var oProfile = Preflight.getProfileByName("Magazine Ads") if( oProfile != undefined ) { var oThermometer = app.thermometer; var myPreflightResult = this.preflight( oProfile, false, oThermometer); if( myPreflightResult.numErrors > 0 ) { console.println( "Preflight found " + myPreflightResult.numErrors + " Errors."); } else { console.println( "Preflight found no Errors."); } } Preflight A Preflight object represents the Preflight tool. Note: Preflight is only available in Acrobat Professional and cannot be accessed from Acrobat Reader. Preflight methods getNumProfiles 9.0 P Page 1 of 6

<strong>JavaScript</strong> <strong>API</strong> [<strong>callas</strong> <strong>Intranet</strong>]<br />

<strong>JavaScript</strong> <strong>API</strong><br />

This chapter is a complete reference to the <strong>Acrobat</strong> extensions to <strong>JavaScript</strong>, its objects, methods, and<br />

properties. The chapter is organized alphabetically by object name.<br />

Doc<br />

Preflight adds one method to the <strong>Acrobat</strong> Doc object allowing to preflight the document.<br />

Doc methods<br />

preflight<br />

9.0 D P<br />

Runs a Preflight profile for the document. An exception is thrown if the Preflight run fails.<br />

Parameters<br />

oProfile The Preflight profile to be used for the Preflight run, described by a PreflightProfile object.<br />

bOmitFixups (optional) Omit all fixups in the Preflight profile. If bOmitFixups is not specified, false is used.<br />

oThermometer<br />

Returns<br />

A PreflightResult object.<br />

Example<br />

http://10.0.0.26/doku.php?id=development:oyster:specs:preflightapi:javascript<br />

10/31/2007 04:32 PM<br />

(optional) Show status window and progress bar that indicates to the user that a lengthy operation is in progress.<br />

To acquire a Thermometer object, use app.thermometer. If oThermometer is not specified, no progress is<br />

shown.<br />

var oProfile = Preflight.getProfileByName("Magazine Ads")<br />

if( oProfile != undefined )<br />

{<br />

var oThermometer = app.thermometer;<br />

var myPreflightResult = this.preflight( oProfile, false, oThermometer);<br />

if( myPreflightResult.numErrors > 0 ) {<br />

console.println( "Preflight found " + myPreflightResult.numErrors + " Errors.");<br />

} else {<br />

console.println( "Preflight found no Errors.");<br />

}<br />

}<br />

Preflight<br />

A Preflight object represents the Preflight tool.<br />

Note: Preflight is only available in <strong>Acrobat</strong> Professional and cannot be accessed from <strong>Acrobat</strong> Reader.<br />

Preflight methods<br />

getNumProfiles<br />

9.0 P<br />

Page 1 of 6


<strong>JavaScript</strong> <strong>API</strong> [<strong>callas</strong> <strong>Intranet</strong>]<br />

Retrieves the number of installed Preflight profiles.<br />

Parameters<br />

oThermometer<br />

Returns<br />

http://10.0.0.26/doku.php?id=development:oyster:specs:preflightapi:javascript<br />

10/31/2007 04:32 PM<br />

(optional) Show status window and progress bar that indicates to the user that a lengthy operation is in progress.<br />

To acquire a Thermometer object, use app.thermometer. If oThermometer is not specified, no progress is<br />

shown.<br />

The number of installed Preflight profiles.<br />

getNthProfile<br />

9.0 P<br />

Retrieves the Nth Preflight profile from the list of installed Preflight profiles.<br />

Parameters<br />

nIndex The 0-based index of the profile that should be obtained.<br />

oThermometer<br />

Returns<br />

(optional) Show status window and progress bar that indicates to the user that a lengthy operation is in progress.<br />

To acquire a Thermometer object, use app.thermometer. If oThermometer is not specified, no progress is<br />

shown.<br />

A PreflightProfile object, the profile that corresponds to nIndex. Undefined otherwise<br />

Example<br />

Enumerate through all of the profiles in Preflight.<br />

var num = Preflight.getNumProfiles(app.thermometer);<br />

for( i= 0; i< num; ++i)<br />

{<br />

var oProfile = Preflight.getNthProfile(i);<br />

console.println("-----------------------------------------");<br />

console.println("Name: " + oProfile.name);<br />

console.println("Comment: " + oProfile.description);<br />

console.println("HasFixups: " + oProfile.hasFixups);<br />

console.println("HasChecks: " + oProfile.hasChecks);<br />

console.println("-----------------------------------------");<br />

}<br />

getProfileByName<br />

9.0 P<br />

Retrieves the Preflight profile with a specific name from the list of installed Preflight profiles.<br />

Parameters<br />

cName The name of the profile that should be obtained.<br />

oThermometer<br />

Returns<br />

(optional) Show status window and progress bar that indicates to the user that a lengthy operation is in progress.<br />

To acquire a Thermometer object, use app.thermometer. If oThermometer is not specified, no progress is<br />

shown.<br />

A PreflightProfile object if a profile with specified name exists, Undefined otherwise.<br />

Page 2 of 6


<strong>JavaScript</strong> <strong>API</strong> [<strong>callas</strong> <strong>Intranet</strong>]<br />

Example<br />

Get profile with name “Magazine Ads”.<br />

var oProfile = Preflight.getProfileByName("Magazine Ads");<br />

if( oProfile != undefined) {<br />

console.println("-----------------------------------------");<br />

console.println("Name: " + oProfile.name);<br />

console.println("Comment: " + oProfile.description);<br />

console.println("HasFixups: " + oProfile.hasFixups);<br />

console.println("HasChecks: " + oProfile.hasChecks);<br />

console.println("-----------------------------------------");<br />

}<br />

createComplianceProfile<br />

9.0 P<br />

Create a compliance profile for a given PDF standard for the document.<br />

Parameters<br />

cStandardKey PDF Standard version to verify<br />

oThermometer<br />

http://10.0.0.26/doku.php?id=development:oyster:specs:preflightapi:javascript<br />

10/31/2007 04:32 PM<br />

(optional) Show status window and progress bar that indicates to the user that a lengthy operation is in progress.<br />

To acquire a Thermometer object, use app.thermometer. If oThermometer is not specified, no progress is<br />

shown.<br />

Valid standard version keys:<br />

Key<br />

PDF/X-1a:2001<br />

PDF/X-1a:2003<br />

PDF/X-3:2002<br />

PDF/X-3:2003<br />

PDF/X-4<br />

PDF/X-5g<br />

PDF/X-5n<br />

PDF/X-5pg<br />

PDF/A-1a:2005<br />

PDF/A-1b:2005<br />

PDF/E:2007<br />

Returns<br />

A PreflightProfile object, Undefined otherwise<br />

Example<br />

Check the current PDF document to PDF/A-1b:2005 compliance.<br />

var oProfile = Preflight.createComplianceProfile("PDF/A-1b:2005")<br />

if( oProfile != undefined )<br />

{<br />

var oThermometer = app.thermometer;<br />

var myPreflightResult = this.preflight( oProfile, true, oThermometer);<br />

if( myPreflightResult.numErrors > 0 ) {<br />

console.println( "PDF document is NOT PDF/A-1b:2005 compliant.");<br />

} else {<br />

console.println( "PDF document is PDF/A-1b:2005 compliant.");<br />

Page 3 of 6


<strong>JavaScript</strong> <strong>API</strong> [<strong>callas</strong> <strong>Intranet</strong>]<br />

}<br />

}<br />

PreflightProfile<br />

http://10.0.0.26/doku.php?id=development:oyster:specs:preflightapi:javascript<br />

10/31/2007 04:32 PM<br />

A PreflightProfile represents a particular Preflight profile; that is a Preflight profile that is installed in the<br />

Preflight tool. The PreflightProfile object can be acquired from the Preflight object method getNthProfile or<br />

getProfileByName.<br />

PreflightProfile properties<br />

9.0 P<br />

Property Type Access Description<br />

name String R The name of the Preflight profile.<br />

description String R A description for the Preflight profile.<br />

hasFixups Boolean R Indicates whether the Preflight profile has fixups.<br />

hasChecks Boolean R Indicates whether the Preflight profile has checks.<br />

PreflightProfile methods<br />

hasConversion<br />

9.0 P<br />

Checks whether the preflight profiles contains a conversion to a specific PDF standard.<br />

Parameters<br />

version The PDF Standard as string “PDF/X-1a”, “PDF/X-3”, “PDF/X-4”, “PDF/A-1a”, “PDF/A-1b”<br />

Returns<br />

Boolean, true if the specified conversion is configured in the profile, false otherwise.<br />

Example<br />

PreflightResult<br />

A PreflightResult represents a particular Preflight result; that is a data structure created by the Preflight tool.<br />

The PreflightResult object can be acquired from the Doc object methods preflight.<br />

PreflightResult properties<br />

9.0 P<br />

Property Type Access Description<br />

numErrors Integer R Indicates the number of errors found in the PDF document.<br />

numWarnings Integer R Indicates the number of warnings found in the PDF document.<br />

numInfos Integer R Indicates the number of infos found in the PDF document.<br />

numFixed 1) Integer R Indicates the number of successfully applied fixups.<br />

numNotFixed 2) Integer R Indicates the number of unsuccessfully applied fixups.<br />

Page 4 of 6


<strong>JavaScript</strong> <strong>API</strong> [<strong>callas</strong> <strong>Intranet</strong>]<br />

PreflightResult methods<br />

report<br />

9.0 P<br />

Creates a Preflight XML report.<br />

Parameters<br />

oThermometer<br />

Returns<br />

http://10.0.0.26/doku.php?id=development:oyster:specs:preflightapi:javascript<br />

10/31/2007 04:32 PM<br />

(optional) Show status window and progress bar that indicates to the user that a lengthy operation is in progress.<br />

To acquire a Thermometer object, use app.thermometer. If oThermometer is not specified, no progress is<br />

shown.<br />

String containing the XML report. This string can be used with XMLData.parse to create an object of type XFA<br />

object that represents either a tree headed by a single node or a tree started by a list of nodes (a tree list).<br />

Example<br />

var oProfile = Preflight.getProfileByName("Magazine Ads")<br />

if( oProfile != undefined )<br />

{<br />

var oThermometer = app.thermometer;<br />

var myPreflightResult = this.preflight( oProfile, false, oThermometer);<br />

if( myPreflightResult.numErrors > 0 ) {<br />

var cXMLData = myPreflightResult.report(oThermometer);<br />

var oXMLData = XMLData.parse(sXMLData, false);<br />

... do something with XMLData object ...<br />

}<br />

PreflightFeat<br />

PreflightFeat properties<br />

9.0 P<br />

Property Type Access Description<br />

versionMajor 3) Integer R Indicates the major version number of the Preflight plug-in.<br />

versionMinor 4) Integer R Indicates the minor version number of the Preflight plug-in.<br />

versionFix 5) Integer R Indicates the fix number of the Preflight plug-in.<br />

versionBuild 6) Integer R Indicates the build number of the Preflight plug-in.<br />

PreflightFeat methods<br />

traceClear()<br />

9.0 P<br />

Clear all trace samples<br />

traceActivate()<br />

9.0 P<br />

Page 5 of 6


<strong>JavaScript</strong> <strong>API</strong> [<strong>callas</strong> <strong>Intranet</strong>]<br />

Activate sampling of trace points<br />

traceDeactivate()<br />

9.0 P<br />

Deactivate sampling of trace points<br />

traceSum<br />

9.0 P<br />

Evaluate the accumulated time for a given trace point.<br />

Parameters<br />

cTracePoint Name of the trace point, e.g. “PREFLIGHT”<br />

Valid Tracepoints are listed in the table below 7) :<br />

Tracepoint Description<br />

LIB_LOAD Load PreflightLib<br />

LIB_INIT Init Lib (Dict, CCW, etc.)<br />

LIB_INIT_PRC Load default profile list<br />

PRC_PACK_LOAD Load Preflight package<br />

PRC_WIZ_LOAD Load profile definitions<br />

PRC_WIZ_ADD_CHECKS 8) Add Wizard Checks<br />

PRC_WIZ_ADD_FIXUPS 9) Add Wizard Fixups<br />

PREFLIGHT_POST Complete Post Check<br />

PREFLIGHT_PRC Prepare PRC profile as part of Preflight check (compress objects etc.)<br />

PREFLIGHT_DVA DVA Checks<br />

PREFLIGHT_PAGE_INKCOVERAGE Preflight ink coverage check<br />

PREFLIGHT_PAGE_HITS Preflight all property checks<br />

FIX Apply Fixups<br />

FIX_OPTIMIZER PDFOptimizer<br />

FIX_CONVERT_COLORS ConvertColors<br />

FIX_HAIRLINES Fix Hairlines<br />

FIX_SAVE Saving fixed file<br />

Returns<br />

Accumulated time for the given trace point cTracePoint as string.<br />

1) , 2) , 3) , 4) , 5) , 6) , 7) Implemented in 9.0.0.002<br />

8) , 9) Implemented in 9.0.0.006<br />

http://10.0.0.26/doku.php?id=development:oyster:specs:preflightapi:javascript<br />

10/31/2007 04:32 PM<br />

development/oyster/specs/preflightapi/javascript.txt ! Last modified: 2007/10/31 15:59 by rgu<br />

Page 6 of 6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!