0% found this document useful (0 votes)
60 views

Distiller APIReference

Uploaded by

kicior
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Distiller APIReference

Uploaded by

kicior
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Acrobat Distiller API

bc Reference

Technical Note #5158


Version : Acrobat 5.0

ADOBE SYSTEMS INCORPORATED


Corporate Headquarters
345 Park Avenue
San Jose, CA 95110-2704
(408) 536-6000
http://partners.adobe.com

August 2002
Copyright 2002 Adobe Systems Incorporated. All rights reserved.
NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in
hardcopy or electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying,
recording, or otherwise, without the prior written consent of the Adobe Systems Incorporated.
PostScript is a registered trademark of Adobe Systems Incorporated. All instances of the name PostScript in the text are references to
the PostScript language as defined by Adobe Systems Incorporated unless otherwise stated. The name PostScript also is used as a
product trademark for Adobe Systems’ implementation of the PostScript language interpreter.
Except as otherwise stated, any reference to a “PostScript printing device,” “PostScript display device,” or similar item refers to a printing
device, display device or item (respectively) that contains PostScript technology created or licensed by Adobe Systems Incorporated
and not to devices or items that purport to be merely compatible with the PostScript language.
Adobe, the Adobe logo, Acrobat, the Acrobat logo, Acrobat Capture, Acrobat Catalog, Acrobat Reader, Acrobat Search, Distiller,
PostScript, and the PostScript logo are trademarks of Adobe Systems Incorporated.
Apple, Macintosh, Power Macintosh, and carbon are trademarks of Apple Computer, Inc., registered in the United States and other
countries. PowerPC is a registered trademark of IBM Corporation in the United States. ActiveX, Microsoft, Windows, and Windows NT
are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries. UNIX is a registered
trademark of The Open Group. All other trademarks are the property of their respective owners.
This publication and the information herein is furnished AS IS, is subject to change without notice, and should not be construed as a
commitment by Adobe Systems Incorporated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or
inaccuracies, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims
any and all warranties of merchantability, fitness for particular purposes, and noninfringement of third party rights.
Documentation Roadmap

Acrobat SDK Documentation Roadmap


Getting Started

Acrobat SDK Getting Started Using the Guide to SDK


Release Notes Adobe Acrobat Software Samples
Development Kit

Acrobat Acrobat Plug-In Acrobat


Development Tutorial Developer FAQ
Overview

Acrobat PDF Acrobat


Extended API for File Format
Core API Creation Interapplication
Plug-ins Specifications
APIs Communication
Acrobat Core (IAC)
Acrobat Catalog Acrobat Distiller Highlight File
API Overview
API Reference Parameters Format Acrobat IAC
Overview
Acrobat Core Acrobat Digital Acrobat Distiller PDF Reference
API Reference Signature API API Reference Manual Acrobat IAC
Reference Reference

Acrobat Digital pdfmark


Programming
Signature API Reference
Acrobat
Overview JavaScript Using
Acrobat PDF Visual Basic
Acrobat Forms Writer API
API Reference Reference

Acrobat Search
API Reference

Acrobat Spelling
API Reference

Acrobat Weblink
API Reference

PDF Consultant
(Scrubber)

Adobe Dialog
Manager Reference
Contents

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Other Useful Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Conventions Used In This Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

Chapter 1 Acrobat Distiller API for Macintosh . . . . . . . . . . . . . 11


Apple Event Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

Chapter 2 Macintosh Methods . . . . . . . . . . . . . . . . . . . . . 13


Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Run. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Quit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Chapter 3 Acrobat Distiller API for Windows . . . . . . . . . . . . . . 19


Windows Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Distiller Command Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Chapter 4 Acrobat Distiller Automation . . . . . . . . . . . . . . . . 25


Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Distiller Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

Chapter 5 Automation Methods . . . . . . . . . . . . . . . . . . . . 27


Create . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
FileToPDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

Chapter 6 Automation Properties . . . . . . . . . . . . . . . . . . . 29

Acrobat Distiller API Reference 5


Contents

bShowWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
bSpoolJobs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Chapter 7 Automation Events . . . . . . . . . . . . . . . . . . . . . 31


OnJobStart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
OnJobDone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
OnJobFail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
OnLogMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
OnPercentDone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
OnPageNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

6 Acrobat Distiller API Reference


Preface

The Adobe® Acrobat® Distiller® application converts PostScript language page


descriptions into Portable Document Format (PDF) files. It is possible to control a
number of parameters used in the conversion by placing Distiller-specific operators in
the PostScript language input file. The parameters that can be set and read include
those to control the compression of text and graphics, downsampling and encoding of
sampled images, and embedding of Type 1 fonts and instances of Type 1 multiple
master fonts. Image downsampling reduces the resolution of an image and is typically
used to optimize images that will most frequently be seen on a monitor, where
resolutions of 72-dpi are common, instead of printed, where resolutions of 300-dpi
and greater are possible. Image encoding is done to compress images, reducing the
amount of disk space needed to store them.
This technical note describes the Acrobat Distiller control interface, present in
version 5 of Acrobat Distiller for the Macintosh and Microsoft® Windows® platforms.
This interface allows other applications to programmatically control the Distiller
program. It consists of Apple events on the Macintosh, and Windows messages and
command line options on Windows.

Contents
This technical note covers two main topics:
● Distiller API methods for Apple Event Support and Windows Messaging. The
Macintosh subsection describes the Distiller API methods available through
AppleScript. This section also discusses the Distiller API methods that are used
with Windows messaging.
● Acrobat Distiller Automation. (Acrobat 4.0 and higher versions) This section
describes the Automation methods available for Distiller.

Other Useful Documentation


You should be familiar with the Portable Document Format (PDF).
PDF Reference, third edition, version 1.4. Provides a description of the PDF file
format, as well as suggestions for producing efficient PDF files. It is intended for
application developers who wish to produce PDF files directly.
PostScript Language Reference, third edition. Your reference to the syntax and
semantics of the PostScript language and the Adobe imaging model.

Acrobat Distiller API Reference 7


Preface
Other Useful Documentation

NOTE: In this document, references to documents that appear online (in blue, italics)
are live links. However, to activate these links, you must install the documents
on your local file system in the same directory structure in which they appear in
the Acrobat SDK. This happens automatically when you install the SDK.

If for some reason you did not install the entire SDK and you do not have all the
documents, please visit the Adobe Solutions Network Web site at
http://partners.adobe.com/asn to find the documents you need. Then install
them in the appropriate directories. You can use the Acrobat SDK
Documentation Roadmap located at the beginning of this document as a guide.

8 Acrobat Distiller API Reference


Preface
Conventions Used In This Document

Conventions Used In This Document

TABLE P.1 Acrobat SDK document conventions

Item Character Definition Use and Examples


File names Courier, 12-point C:\templates\Acrobat_docs
Code items within plain text; Courier, 12-point, bold The GetExtensionID method returns
parameter names in an ASAtom object
reference documents
Code examples set off from Courier, 10-point, plain These are variable declarations:
plain text AVMenu commandMenu,helpMenu;
Code values within plain Helvetica, 11-point, plain; The method returns true or false
text (same as plain text) A null pointer
Pseudocode Helvetica, 11-point, italic ACCB1 void ACCB2 ExeProc(void)
{
do something
}
Cross references to Web Blue text; everything else The Acrobat Solutions Network URL is:
pages “as-is” http://partners.adobe.com/asn
Cross references to titles of Blue text; Helvetica, See the Acrobat Core API Overview.
other Acrobat SDK 11-point, italic
documents
Cross references within a Blue text; everything else See Section 3.1, “Using the SDK.”
document “as-is” Test whether an ASAtom exists.
PostScript language Helvetica, 11-point, bold The setpagedevice operator
operators, PDF operators, The File menu
keywords, dictionary key
names;user interface
names
Document titles that are not Helvetica, 11-point, italic Acrobat Core API Overview
cross-reference links to filename deletefile
other Acrobat SDK
documents, new terms,
PostScript variables

Acrobat Distiller API Reference 9


Preface
Conventions Used In This Document

10 Acrobat Distiller API Reference


1 Acrobat Distiller API for
Macintosh

Apple Event Support


The Macintosh version of the Distiller program supports Apple events. Apple events
can be used from programming languages such as C or from AppleScript. Because
AppleScript is more straightforward, using it is the recommended way to use Apple
events with the Distiller program. Software that uses Apple events can tell the Distiller
program to:
● Open and distill one or more PostScript® language files, creating a Portable
Document Format (PDF) file for each. Each PDF file can either have the name of
the original file (but with a .PDF extension) or the name of each PDF file can be
independently specified.
● Process PostScript language files, as above, but not return control until the Distiller
program has finished distilling all the PDF files that were specified.
● Launch or quit the Distiller program.
The notation used in this document follows that used in the AppleScript Language
Guide, published by Addison–Wesley (ISBN 0–201–40735–3).
● Keywords are shown in roman faces, parameters in italics.
● Optional items are enclosed in [square brackets].
Each piece of AppleScript example code in this document assumes that it is being
executed within an appropriate tell – end construct, for example:
on run
tell application "Acrobat™ Distiller™ 4.0"
[Your code]
end tell
end run
The Distiller program supports three of the four required Apple events: open, run, and
quit. While the fourth required event, print, is present, it simply generates an error
message because printing has no meaning in the Distiller program.

Acrobat Distiller API Reference 11


Acrobat Distiller API for Macintosh
1
Apple Event Support

12 Acrobat Distiller API Reference


2 Macintosh Methods

Open
open sourceFile [destination destfile] [joboptions file]
[hide boolean] [openpassword string] [changepassword
string] [printing boolean] [changing boolean]
[selecting boolean] [notechanging boolean] [with wait]
Description
Opens one or more files for the Distiller program to process. If the optional with
wait is used, the Distiller program returns control only after a PDF file (or log file) is
created, instead of immediately. Multiple source and destination files may be
specified.
Setting this to true will cause Distiller to wait for the file(s) to finish distilling before
allowing this Apple event to succeed. (Do not bring Distiller to the foreground or you
will not get proper completion notification.)
The open Apple event supported by the Distiller program is an enhanced version of
the open Apple event.

Acrobat Distiller API Reference 13


Macintosh Methods
2
Open

Parameters

destination (Optional) The destination file or files to open.

joboptions (Optional) String that specifies a joboptions file to use. It


is safest to use a full path name to the option file.
hide (Optional) If true, Distiller hides the main status window.
If false, the default, the window is not hidden.
openpassword (Optional) A string that specifies the password for opening
the document(s). Encrypts the output documents.
This is the same as the option found in the Distiller
“Security” dialog window.
changepassword (Optional) A string that specifies the password for
changing the document(s) security settings. Encrypts the
output documents.
This is the same as the option found in the Distiller
“Security” dialog window.
printing (Optional) If true, the default, allows printing the
document. If false, does not allow printing the output
documents.
This is the same as the option found in the Distiller
“Security” dialog window.
changing (Optional) If true, the default, allows changing the
document. If false, does not allow editing the output
documents.
This is the same as the option found in the Distiller
Security dialog window.
selecting (Optional) If true, the default, allows selecting text and
graphics in the document. If false, does not allow
selecting text and graphics in the output documents.
This is the same as the option found in the Distiller
“Security” dialog window.
notechanging (Optional) If true, the default, allows adding or changing
of annotations such as notes and form fields. If false,
does not allow adding or changing notes and form fields in
the output documents.
This is the same as the option found in the Distiller
“Security” dialog window.

14 Acrobat Distiller API Reference


Macintosh Methods
2
Open

withwait (Optional) If true, the default, causes Distiller to wait for


the file(s) to finish distilling before allowing this Apple event
to succeed.
N O T E : Do
not bring Distiller to the foreground or your
application will not get proper completion
notification.

Return Value
None
Example
open "report.ps" destination "mayreport.pdf"
joboptions "MyDisk:Adobe
Acrobat 4.0:Distiller:Settings:PrintOptimized.joboptions"
openPassword "MyPassword" changePassword "MyPassword" with wait without
printing

Acrobat Distiller API Reference 15


Macintosh Methods
2
Run

Run
run
Description
Launches the Distiller program and invokes its standard startup procedures.
Parameters

None

Return Value
None
Example
run

16 Acrobat Distiller API Reference


Macintosh Methods
2
Quit

Quit
quit
Description
Terminates the Distiller program.
Parameters

None

Return Value
None
Example
quit

Acrobat Distiller API Reference 17


Macintosh Methods
2
Quit

18 Acrobat Distiller API Reference


3 Acrobat Distiller API for Windows

Windows Messaging
The Microsoft® Windows® version of the Distiller program supports two Windows
messages that:
● Specify the file or files to process and the output destination.
● Confirm when each file specified in the first Windows message has completed
processing.
The enumerated data types and constants necessary to use the Windows messaging
portion of the Distiller control interface are defined in the file distctrl.h. This file is
included in the Acrobat Software Development Kit (SDK). Source files that use the
Distiller control interface must include distctrl.h.
Members of a structure of type DISTILLRECORD (defined in distctrl.h) are set to
specify the list of files to distill and the destination for the output files. Applications
should fill in the structure members listed in Table 3.1.

TABLE 3.1 Members of the DISTILLRECORD structure

Structure Member Description


param One of the values listed in Table 3.2.

fileList Comma-delimited list of files to distill (char).

outputFile Destination path for output file or files (char). If


multiple files are specified for fileList, specify a
directory rather than a specific file, or each
destination file will be overwritten by the next.

One of the options listed in Table 3.2 must be specified in the SendMessage call to
control the appearance of the Save dialog box when each source file is processed.

TABLE 3.2 EnqueueOption constants

Constant Description
EQ_NO_SAVE_DIALOG Do not display the Save dialog box.

EQ_DEFAULT_OLD_DEST Display the Save dialog box. Use the most recent
destination directory as the default destination
directory.

Acrobat Distiller API Reference 19


Acrobat Distiller API for Windows
3
Windows Messaging

TABLE 3.2 EnqueueOption constants

Constant Description
EQ_DEFAULT_SOURCE Display the Save dialog box. Use the source file’s
directory as the default destination directory.

To tell the Distiller program to begin processing the file list, a COPYDATASTRUCT
containing the DM_DISTILL message and a pointer to a filled out DISTILLRECORD
needs to be sent to the Distiller program. The following example tells the Distiller
program to process a PostScript language file and store the resulting PDF file in a
specified directory, omitting the unnecessary Save dialog box.
DISTILLRECORD dr; /* from distctrl.h */
COPYDATASTRUCT cds;
BOOL ok;
LRESULT rtn;
WORD res=0;
char msg[ 80];
hinst = ShellExec( NULL, "acrodist.exe", strCmdArgs, NULL, SW_SHOW);
if (res<32){
sprintf(msg, "WinExec failed: error code = %d", res);
return;
}
CWnd *hDistillerCWnd = FindWindow("Distiller", NULL);
if (hDistillerCWnd != NULL)
{
strcpy(dr.outputFile, "c:\\ OUT.PDF");
strcpy(dr.fileList, "C:\\ TEST.PS");
dr.param = EQ_NO_SAVE_DIALOG;/* from distctrl.h */
cds.dwData = DM_DISTILL;
cds.cbData = sizeof(DISTILLRECORD);
cds.lpData = (PVOID)&dr;
ok = (BOOL)hDistillerCWnd->SendMessage(WM_COPYDATA,
(WPARAM)m_hWnd, (LPARAM)&cds);
if (ok)
/* wake up Distiller */
hDistillerCWnd->PostMessage(WM_TIMER, ID_TIMER, 0L);
}
If the sending application is specified in the WPARAM parameter of the SendMessage
call, a WM_COPYDATA message is returned to the application after each file specified
has been distilled. The LPARAM parameter of this WM_COPYDATA message will
contain a COPYDATASTRUCT that will include a Distiller DM_DONE message and a
pointer to a structure of type DISTILLRECORD. The fileList member of the
structure contains the name of the PostScript language file that was processed, and
the outputFile member contains the name of the resulting PDF file.
The distctrl.h file for Windows 32-bit is different from the one for Windows 16-bit
since the WM_COPYDATA message and COPYDATASTRUCT structure are not defined
for Windows 16-bit. Make sure you use the correct distctrl.h for your application.

20 Acrobat Distiller API Reference


Acrobat Distiller API for Windows
3
Distiller Command Line Options

In addition to the old WM_COPYDATA interface that uses the awkward and limited
DISTILLRECORD structure, there is a new WM_COPYDATA interface that simply lets
you pass a command line. This way you can use any of the command line options,
such as /J to specify the job options file (which the old WM_COPYDATA interface does
not allow).
Using the new WM_COPYDATA interface is similar to the old, except you create a
command line string instead of a data structure. An example:
char szCmdLine[] = "/O outfile.pdf /J myoptions.joboptions infile.ps"
COPYDATASTRUCT cds;
cds.dwData = DM_CMDLINE;
cds.cbData = strlen(szCmdLine) + sizeof(char);
cds.lpData = szCmdLine;
SendMessage( hwndDistiller, WM_COPYDATA,
(WPARAM)hwndMyWindow, (LPARAM)&cds );

Distiller Command Line Options


Distiller 5.0 supports the same command line and WM_COPYDATA interfaces and
several new switches and options.
The Distiller program supports options passed as arguments on the command line.
The command line is accessed from the Windows 95/98 or Windows NT Start -> Run
menu option or from another Windows program using the WinExec function.
The syntax of the Distiller 5.0 command line is:
acrodist [switches] [inputFiles]
If any switches are present, they must come before any input files. Switches and
input file names are both optional. The command acrodist by itself runs Distiller, or
if a normal instance of Distiller is already running, it brings Distiller to the foreground.
The switches parameter is a list of any of the optional commands. Either the - or /
character can begin a switch, which is identified by a single case-independent letter.
There should be a space after the switch letter, and if the switch takes a parameter,
another space after the parameter. (The parameter should be quoted if it contains any
spaces.) Do not try to combine switches—give each one its own - or / prefix.
The parameter inputFiles is a list of filenames, separated by spaces or commas.
Spaces and commas are both legal filename characters; if a filename contains
spaces or commas, it should be enclosed in double quotes.
To process a list of PostScript® language files:
acrodist [switches] inputFiles[, inputFiles...]

Acrobat Distiller API Reference 21


Acrobat Distiller API for Windows
3
Distiller Command Line Options

In Table 3.3, “Command Line Switches” the optional command line switches are
listed.

TABLE 3.3 Command Line Switches

Switch Description
/E [jobOptionsFilePath] Opens Distiller’s Job Options dialog to edit the specified Job
Options file. If you give the filename with no path, Distiller looks
in its Settings folder for the file. If you omit the filename,
Distiller uses the current default Job Options file.
This switch may not be combined with any other command line
options. Distiller will not process any PostScript files and does
not display its main window. It just opens the Job Options dialog
and exits when you close that window.
/F (Distiller 5.0 and higher) Restricts the PostScript file operators
(see Section 8.1, “Operator Summary,” page 518, in the
PostScript Language Reference, third edition) to read-only
access to all directories and files in the Distiller installation
directory with the exception that write access is allowed in the
temporary and hostfont cache directories. For example, if
Distiller’s installation directory is:
C:\Programs\Adobe\Acrobat5.0\Distiller\
then the temporary directory is:
C:\Programs\Adobe\Acrobat5.0\Distiller\Tmp\
${PID}
where {PID} is the process ID of Distiller, and the hostfont
cache directory is:
C:\Programs\Adobe\Acrobat5.0\Distiller\Cache\
Without using this /F command line switch, there is no change
in functionality: a PostScript program will be able to freely use
all the file operators.
/J [jobOptionsFilePath] Uses jobOptionsFilePath as the Job Options file for any
input files specified on the command line. Does not affect any of
the Job Options settings you can set with the UI.
/N Runs a new instance of Distiller, even if another Distiller is
already running. (Without this switch, Distiller switches to any
“normal” previous instance.) The Distiller instance created with
this switch does not process watched folders and is marked so
that it will not get activated by other “normal” Distillers that get
launched later.

22 Acrobat Distiller API Reference


Acrobat Distiller API for Windows
3
Distiller Command Line Options

TABLE 3.3 Command Line Switches

Switch Description
/O outputFileOrFolderPath Specifies the output PDF file name or a directory name to put
PDF files in. If you give a directory name, Distiller uses the input
filename for each input file. To process a PostScript language
file and name the output PDF file:
acrodist /o destFile sourceFile
To process a list of PostScript language files and place the
output PDF files in a specified directory:
acrodist /o directory sourceFile1[,
sourceFile2...]
/Q (:seconds) Tells Distiller to exit immediately when it becomes idle.
If /N is also used, quits Distiller after processing all files on the
command line. If /N is not used, quit Distiller after processing
all PostScript language files in watched directories and any that
were specified on the command line.
To force the Distiller program to terminate when it has finished
distilling all PostScript language files in watched directories and
any that were specified on the command line:
acrodist /q [sourceFile1[, sourceFile2...]]
/Q also accepts an optional timeout value in seconds, "/Q:n".
Use the timeout to tell Distiller to wait until n seconds of idle
time before exiting.
/V Forces Distiller to view or not view the generated PDF, as
described below:
/V or /V:on Turns on viewing of the generated PDF, but
viewing can be turned off either later in the command line or in
the user interface.
/V:off Turns off viewing of the generated PDF, but viewing
can be turned on either later in the command line or in the user
interface.
/V- Turns off viewing permanently in this instance of Distiller.
N O T E : /v can
be substituted for /V throughout, but on and off
are case sensitive:ON and OFF will not work.

Acrobat Distiller API Reference 23


Acrobat Distiller API for Windows
3
Distiller Command Line Options

24 Acrobat Distiller API Reference


4 Acrobat Distiller Automation

Introduction
The previous chapters in this document described two ways to automate Distiller:
● WM_COPYDATA interface
● Command line interface
The WM_COPYDATA interface provides compatibility for older applications only. It
works exactly as before, and you cannot use any of Distiller’s new features such as
job options files and input piping through it.
For new applications, the best way to automate Distiller under Microsoft Windows is
through the new Automation interface also known as OLE Automation (commonly
referred to as ActiveX® or COM). The Automation interface makes it easy to create
and control a Distiller from any programming language that supports Automation. We
support programming environments written in:
● Visual Basic
● Visual C++ with and without MFC

Distiller Automation
Distiller exposes one interface: PdfDistiller. This interface provides methods,
properties and events. Unless noted, all examples use Visual Basic notation.

Example
In Visual Basic, if you want to just create and use a Distiller without spooling or events,
the code can be as simple as:
Dim pdf As PdfDistiller
pdf.FileToPdf "My Test File.ps", "", ""

Contents
The remainder of this document contains the following reference chapters:
● Automation Methods. This section describes of each Automation method, including
its parameters, return value, and related methods.

Acrobat Distiller API Reference 25


Acrobat Distiller Automation
4
Contents

● Automation Properties. This section details the properties that can be set in the
various objects. Each property describes the key, the property type (for example,
read-only), and the semantic.
● Automation Events. As it processes each job, Distiller fires several events to notify
you of its progress. This section describes these events.

26 Acrobat Distiller API Reference


5 Automation Methods

Create
Description
Creates a Distiller instance. You do not need to call this method; a Distiller instance is
always created if one of the other methods needs it. You may want to call this if you
are handling events and want to display Distiller’s startup messages before you
submit any jobs.
Each user of the Automation interface gets its own Distiller instance. There is no
sharing of a common Distiller as was done with Distiller 3.0 and the WM_COPYDATA
interface.
Parameters
None
Return Value
None
Exceptions
None

Acrobat Distiller API Reference 27


Automation Methods
5
FileToPDF

F i l e To P D F
Description
Submits a PostScript file job to the Distiller.
Parameters

strInputPostScript The PostScript file to process.


strOutputPDF The name of the PDF filename.

strJobOptions The name and path of the Job Options file to use.

Return Value
None
Exceptions
None

28 Acrobat Distiller API Reference


6 Automation Properties

bShowWindow
[get/set] As Long
Description
Specifies whether Distiller opens with the status windows. This property takes
effect only if you set it before calling the Create method or any other method.
If you have already started Distiller, bShowWindow has no effect.

Acrobat Distiller API Reference 29


Automation Properties
6
bSpoolJobs

bSpoolJobs
[get/set] As Long
Description
Specifies whether Distiller queues PDF jobs through its internal spooler or processes
each job immediately.
By default, bSpoolJobs is false, and FileToPDF processes the PDF job
immediately and does not return until the PDF file is created.
If bSpoolJobs is true, FileToPDF submits the PDF job to Distiller’s internal job
queue and returns immediately. The job will be processed at some later time. To find
out when the job is done, you can watch for the events Distiller runs during job
processing.

30 Acrobat Distiller API Reference


7 Automation Events

OnJobStart
Run once when a job begins processing.
OnJobStart( ByVal strInputPostScript As String,
ByVal_ strOutputPDF As String )

OnJobDone
Run once when a job completes successfully.
OnJobDone( ByVal strInputPostScript As String,
_ByVal strOutputPDF As String )

OnJobFail
Run once when a job ends unsuccessfully.
OnJobFail( ByVal strInputPostScript As String,
_ByVal strOutputPDF As String )

OnLogMessage
Run at various times with the text messages that normally appear in Distiller’s
message log window. The text contains the usual carriage return-line feed pair at the
end of each line. A single call to OnLogMessage may contain multiple lines or partial
lines of text.
OnLogMessage( ByVal strMessage As String )
In the current version of Distiller, the text that is passed in this message may contain
line feed characters without carriage return characters. The application should not
make any assumptions about how this text is formatted and should be prepared to
receive either line feed characters (LF) alone or carriage return - line feed (CR-LF)
pairs.

Acrobat Distiller API Reference 31


Automation Events
7
OnPercentDone

OnPercentDone
Run periodically during a job to indicate overall progress.
OnPercentDone( ByVal nPercentDone As Long )

OnPageNumber
Run periodically during a job to indicate the current page number.
OnPageNumber( ByVal nPageNumber As Long )

32 Acrobat Distiller API Reference

You might also like