Layer | AV_Layer |
Object | AVCommand |
An AVCommand represents an action that the user can perform on the current document or the current selection in the current document. An AVCommand can be added to a command sequence and executed either interactively or by means of batch processing, using the method AVCommandExecute().
Invoking AVCommand objects programmatically
To invoke AVCommand objects programmatically using the AVCommand methods, a plug-in client must:
To instantiate an AVCommand, the client must call the AVCommandNew() method, providing the registered name of the command, as shown in the example below. For details on registering AVCommand handlers, see Developing Plug-ins and Applications.
Example
ASAtom cmdName;
AVCommand cmd;
cmdName = ASAtomFromString ("MinimalCommand");
cmd = AVCommandNew (cmdName);
Configuring Commands
Prior to executing the AVCommand, the client can configure three categories of properties:
Input parameters (required).
At minimum, the client must configure the AVCommand object's input parameters. The command must be provided with a PDDoc upon which to operate, as shown in the following example:
Example
PDDoc pdDoc; // Initialized elsewhere
// Create cab to hold input parameters and populate
ASCab inputs = ASCabNew();
ASCabPutPointer (inputs, kAVCommandKeyPDDoc, PDDoc, pdDoc, NULL);
// Set the input parameters and destroy the container ASCab
if (kAVCommandReady != AVCommandSetInputs (cmd, inputs)) { /* Handle error */ }
ASCabDestroy (inputs);
Configuration parameters (optional - initialized to defaults).
The default user interface policy is for commands to be fully interactive. To invoke the command programmatically instead, the client can create an ASCab object and populate it with the appropriate parameters, as shown in the following example:
Example
// Create cab to hold config parameters and populate
ASCab config = ACabNew();
ASCabPutInt (config, "UIPolicy", kAVCommandUISilent);
if (kAVCommandReady != AVCommandSetConfig (cmd, config)) { /* Handle error */ }
ASCabDestroy (config);
AVCommand parameters (optional - initialized to defaults).
An AVCommand object's parameter set is specific to each command. For example, the Document Summary command accepts values for five parameters: Title, Subject, Author, Keywords, Binding, and LeaveAsIs. As in the configuration parameters example, a plug-in can create ASCab objects to hold the appropriate parameters; then it can create empty ASText objects to hold the parameter values and put these values in the ASCab objects. The following example uses this approach to set Document Summary title and subject values:
Example
const char *docTitleValue = "Document Title";
const char *docSubjectValue = "Document Subject";
// Create cab to hold command parameters and populate
ASCab params = ASCabNew();
ASText text = ASTextNew();
ASTextSetEncoded (text, docTitleValue, (ASHostEncoding)PDGetHostEncoding());
ASCabPutText (params, docTitleKey, text);
ASCabPutText (params, docTitleKey, text);
ASTextSetEncoded (text, docSubjectValue, (ASHostEncoding)PDGetHostEncoding());
ASCabPutText (params, docSubjectKey, text);
...
ASCabDestroy(params);
Define | ||
---|---|---|
kAVCommandKeyASFileSys
AVCommandStringConstants
|
||
kAVCommandKeyASPathName
AVCommandStringConstants
|
||
kAVCommandKeyAVDoc
AVCommandStringConstants
|
||
kAVCommandKeyBaseFileName
If possible, use kAVCommandKeyBaseFileNameASText instead.
|
||
kAVCommandKeyBaseFileNameASText
AVCommandStringConstants
|
||
kAVCommandKeyCanBatch
AVCommandStringConstants
|
||
kAVCommandKeyCanDescribeParams
AVCommandStringConstants
|
||
kAVCommandKeyCanPause
AVCommandStringConstants
|
||
kAVCommandKeyCanShowDialog
AVCommandStringConstants
|
||
kAVCommandKeyFireWhenModal
AVCommandStringConstants
|
||
kAVCommandKeyGenericTitle
AVCommandStringConstants
|
||
kAVCommandKeyGroupTitle
AVCommandStringConstants
|
||
kAVCommandKeyInstructions
AVCommandStringConstants
|
||
kAVCommandKeyIsDocStatus | ||
kAVCommandKeyIsStatus
AVCommandStringConstants
|
||
kAVCommandKeyIsTask | ||
kAVCommandKeyNeedPause
AVCommandStringConstants
|
||
kAVCommandKeyOrigExtension
AVCommandStringConstants
|
||
kAVCommandKeyParams
AVCommandStringConstants
|
||
kAVCommandKeyParamsDesc
AVCommandStringConstants
|
||
kAVCommandKeyPDDoc
AVCommandStringConstants
|
||
kAVCommandKeyScreenName
AVCommandStringConstants
|
||
kAVCommandKeyTitle
AVCommandStringConstants
|
Typedef | ||
---|---|---|
AVCommand
An AVCommand represents an action that the user can perform on the current document or the current selection in the current document. Specifically, an AVCommand represents a command which can be added to a command sequence and executed either interactively or via batch processing.
|
||
AVCommandHandler | ||
AVCommandHandlerRec |
Enumeration | ||
---|---|---|
AVCommandStatus
An enumerated list of status codes that can be returned by various AVCommand methods.
|
||
AVCommandUIPolicy
An enumeration detailing how the command is expected to interact with the user.
|
Structure | ||
---|---|---|
_t_AVCommandHandler
A set of callbacks that perform the actions required of a command.
|
Callback | ||
---|---|---|
AVCommandCancelProc
Stop working and clean up as though the command executed to completion.
|
||
AVCommandCreatedProc
Called after a command is created. The command handler can establish default parameters and so forth for the newly created command.
|
||
AVCommandDestroyProc
Called before a command is destroyed. The command handler should free any memory allocated by the command.
|
||
AVCommandGetProc
Retrieves a cabinet from a command. It is used in the GetParams and GetProps members of the AVCommandHandlerRec structure. When retrieving command parameters, the handler should first remove any existing items from theCab using ASCabMakeEmpty(), and then copy all parameter values from the command into theCab. When retrieving properties, the command handler should replace any entries in theCab with key names it recognizes with copies of the command-specific properties.
|
||
AVCommandPostflightFileProc
Every command in a sequence has its Postflight command callback called after all commands in a given sequence have been executed but before the file is closed.
|
||
AVCommandPostflightSequenceProc
Every command in a sequence has its Postflight command callback called after the sequence is executed.
|
||
AVCommandPreflightFileProc
Every command in a sequence has its Preflight callback called after each file has been opened to be processed but before any commands have been executed on that file. If any of the Preflight callbacks returns an error, the sequence is aborted.
|
||
AVCommandPreflightSequenceProc
Every command in a sequence has its Preflight callback called before the sequence is executed. If any of the Preflight callbacks returns an error, the sequence is aborted.
|
||
AVCommandResetProc
Stops working, clears any errors, and tries to get back into a Ready state. For many commands this is equivalent to cancelling.
|
||
AVCommandSetProc
Called to set a cabinet within a command. It is used in the SetParams member of the AVCommandHandlerRec structure. The command handler should copy any information from the cabinet into the command. It must not destroy or modify the cabinet.
|
||
AVCommandShowDialogProc
Displays the command's parameter setting dialog box and allows the user to alter the parameters.
|
||
AVCommandWorkProc
Do some work. If it does not finish its work, return kAVCommandWorking. If it does finish its work, return kAVCommandDone. If the user cancels the operation, return kAVCommandCanceled. If an error occurs, return kAVCommandInError.
|
Method | ||
---|---|---|
AVCommandStatus AVCommandCancel(AVCommand cmd)
Cancels the specified command. If the command is currently processing a file, the command might not attempt to roll back any modifications it has made to the document. This may leave the PDF in an invalid state.
|
||
void AVCommandDestroy(AVCommand cmd)
Destroys the specified command and its associated resources.
|
||
AVCommandStatus AVCommandExecute(AVCommand cmd)
Runs the specified AVCommand, after it has been set up using AVCommandSetInputs() and AVCommandSetParams().
|
||
AVDoc AVCommandGetAVDoc(AVCommand cmd)
Retrieves the AVDoc from a command's inputs ASCab.
|
||
Returns the ASCab stored in the specified command under the key. If the cabinet is not available, this method will create it if create is set to true. The command retains ownership of the returned cabinet.
|
||
ASCancelProc AVCommandGetCancelProc(AVCommand cmd)
Returns a cancellation procedure for the command. If the user interface policy is anything other than kAVCommandUIInteractive, this cancellation procedure must be used. If the user interface policy is kAVCommandUIInteractive, an appropriate default cancel proc will be provided, but the command may use a more appropriate one it if preferred. Pass in the command itself as the client data.
|
||
Retrieves the configuration parameters for the specified command.
|
||
Retrieves the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. The contents of the cabinet are dependent on the mechanism through which the command is initialized.
|
||
ASAtom AVCommandGetName(AVCommand cmd)
Returns the name of the command.
|
||
Retrieves the parameter set for the specified command. It is possible that some commands have no parameters that can be configured, in which case no data will be written to params. The params cabinet should be empty when passed in. Upon return, it will be filled with copies of all of the command's parameter settings.
|
||
PDDoc AVCommandGetPDDoc(AVCommand cmd)
Retrieves the PDDoc from a command's inputs ASCab.
|
||
ASProgressMonitor AVCommandGetProgressMonitor(AVCommand cmd)
Returns a progress monitor the command can use to report progress. The command itself should be passed in as the clientData associated with the monitor's callbacks.
|
||
Retrieves the properties of the specified command. Properties are values intrinsic to the command or to the command's current state.
|
||
ASReportProc AVCommandGetReportProc(AVCommand cmd)
Returns the ASReportProc associated with the specified command. AVCommandHandlers should report all error and status messages through this procedure.
|
||
AVCommandStatus AVCommandGetStatus(AVCommand cmd)
Returns the current status of the specified command.
|
||
AVCommandUIPolicy AVCommandGetUIPolicy(AVCommand cmd)
Retrieves the user interface policy that the command will respect while it is executed. The user interface policy is determined by a combination of the command's configuration and the context in which the command is executing (for example, a batch sequence).
|
||
AVCommand AVCommandNew(ASAtom name)
Creates a new command of the specified type. An AVCommandHandler for that command type must have already been registered. See AVCommand Descriptions (Built-in Commands) for the names and parameters of built-in commands, as defined in AVCmdDefs.h.
|
||
Stores a cabinet in the specified command. If a cabinet is currently stored under the key, it is overwritten. The command assumes ownership of cabVal.
|
||
AVCommandStatus AVCommandReset(AVCommand cmd)
Resets the specified command. The command is expected to clean up its current state and assume a ready state.
|
||
Sets the configuration for the specified command. See AVCommandGetConfig() for more information.
|
||
Sets the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. Use this method and AVCommandSetParams() to set up a command before calling AVCommandExecute() to execute it.
|
||
Sets the parameters for the specified command. The parameters are those pieces of information that can be controlled by the user, such as the pages to act on. Use this method and AVCommandSetInputs() to set up a command before calling AVCommandExecute() to execute it.
|
||
AVCommandStatus AVCommandShowDialog(AVCommand cmd)
Instructs the command to bring up its configuration dialog box and gather parameter information from the user. The dialog box is shown regardless of the UIPolicy of the command.
|
||
AVCommandStatus AVCommandWork(AVCommand cmd)
Instructs the command do some work based on its current parameters.
|
kAVCommandKeyASFileSys |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyASFileSys "ASFileSys"
File: AVExpT.h |
Line: 8832 |
kAVCommandKeyASPathName |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyASPathName "ASPathName"
File: AVExpT.h |
Line: 8835 |
kAVCommandKeyAVDoc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyAVDoc "AVDoc"
File: AVExpT.h |
Line: 8841 |
kAVCommandKeyBaseFileName |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyBaseFileName "BaseFileName"
If possible, use kAVCommandKeyBaseFileNameASText instead.
File: AVExpT.h |
Line: 8846 |
kAVCommandKeyBaseFileNameASText |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyBaseFileNameASText "BaseFileNameASText"
File: AVExpT.h |
Line: 8849 |
kAVCommandKeyCanBatch |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyCanBatch "CanBatch"
File: AVExpT.h |
Line: 8870 |
kAVCommandKeyCanDescribeParams |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyCanDescribeParams "CanDescribeParams"
File: AVExpT.h |
Line: 8867 |
kAVCommandKeyCanPause |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyCanPause "CanPause"
File: AVExpT.h |
Line: 8888 |
kAVCommandKeyCanShowDialog |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyCanShowDialog "CanShowDialog"
File: AVExpT.h |
Line: 8873 |
kAVCommandKeyFireWhenModal |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyFireWhenModal "FireWhenModal"
File: AVExpT.h |
Line: 8882 |
kAVCommandKeyGenericTitle |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyGenericTitle "GenericTitle"
File: AVExpT.h |
Line: 8855 |
kAVCommandKeyGroupTitle |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyGroupTitle "GroupTitle"
File: AVExpT.h |
Line: 8876 |
kAVCommandKeyInstructions |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyInstructions "Instructions"
File: AVExpT.h |
Line: 8891 |
kAVCommandKeyIsDocStatus |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyIsDocStatus "IsDocStatus"
File: AVExpT.h |
Line: 10075 |
kAVCommandKeyIsStatus |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyIsStatus "IsStatus"
File: AVExpT.h |
Line: 8879 |
kAVCommandKeyIsTask |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyIsTask "IsTask"
File: AVExpT.h |
Line: 9970 |
kAVCommandKeyNeedPause |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyNeedPause "NeedPause"
File: AVExpT.h |
Line: 8885 |
kAVCommandKeyOrigExtension |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyOrigExtension "OrigExtension"
File: AVExpT.h |
Line: 8852 |
kAVCommandKeyParams |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyParams "Params"
File: AVExpT.h |
Line: 8861 |
kAVCommandKeyParamsDesc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyParamsDesc "ParamsDesc"
File: AVExpT.h |
Line: 8864 |
kAVCommandKeyPDDoc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyPDDoc "PDDoc"
File: AVExpT.h |
Line: 8838 |
kAVCommandKeyScreenName |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyScreenName "ScreenName"
File: AVExpT.h |
Line: 8894 |
kAVCommandKeyTitle |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
#define kAVCommandKeyTitle "Title"
File: AVExpT.h |
Line: 8858 |
AVCommand |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
typedef struct _t_AVCommandRec* AVCommand;
An AVCommand represents an action that the user can perform on the current document or the current selection in the current document. Specifically, an AVCommand represents a command which can be added to a command sequence and executed either interactively or via batch processing.
File: AVExpT.h |
Line: 8961 |
AVCommandHandler |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
typedef AVCommandHandlerRec AVCommandHandler;
File: AVExpT.h |
Line: 9281 |
AVCommandHandlerRec |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
typedef _t_AVCommandHandler AVCommandHandlerRec;
File: AVExpT.h |
Line: 9280 |
AVCommandStatus |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
enum AVCommandStatus {
kAVCommandReady,
kAVCommandWorking,
kAVCommandDone,
kAVCommandCanceled,
kAVCommandInError,
kAVCommandCanceledForMultiple,
kAVCommandNotExecuted,
kAVCommandPaused
}
See Also
File: AVExpT.h |
Line: 8901 |
kAVCommandReady | Not working, but ready to work. |
|
kAVCommandWorking | Still working. |
|
kAVCommandDone | Done working. |
|
kAVCommandCanceled | Cancelled. |
|
kAVCommandInError | In error. |
|
kAVCommandCanceledForMultiple | Cancelled in favor of running this command (with the current parameters) in a sequence of multiple files. |
|
kAVCommandNotExecuted | Command not executed due to lack of objects on which the command to be executed. |
|
kAVCommandPaused | Paused. |
AVCommandUIPolicy |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
enum AVCommandUIPolicy {
kAVCommandUIInteractive = 0,
kAVCommandUISemiInteractive = 1,
kAVCommandUIErrorsOnly = 2,
kAVCommandUISilent = 3
}
See Also
File: AVExpT.h |
Line: 8935 |
kAVCommandUIInteractive | Fully interactive. Gather parameters based on the currently active document at the time the dialog box is displayed. Display errors and warnings. |
|
kAVCommandUISemiInteractive | Interactive but under the control of the sequencing user interface. When showing a dialog box, use the parameters passed in, rather than the parameters gathered from the document. |
|
kAVCommandUIErrorsOnly | Display errors but no other dialog boxes. |
|
kAVCommandUISilent | Never display a dialog box. |
_t_AVCommandHandler |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
struct _t_AVCommandHandler {
A set of callbacks that perform the actions required of a command.
File: AVExpT.h |
Line: 9207 |
size | The size of the structure. Set it to |
|
Initialize | Called once for each handler registered. |
|
Terminate | Called once for each handler registered when Acrobat shuts down. It is called before plug-ins are unloaded |
|
RegisterCommands | The application maintains a global list of commands that you can choose from when building your own command. During the initialization sequence, all registered command handlers are asked to build and register all the commands that the handler wants to include in the global command list. |
|
Created | Called after a command is created. The command handler can establish default parameters and so forth for the newly created command. |
|
Destroy | Called before a command is destroyed. The command handler should free any memory allocated by the command, and so on. |
|
SetParams | Called to set the command's parameters. |
|
GetParams | Called to retrieve the command's parameters. |
|
GetProps | Called to retrieve command properties. |
|
ShowDialog | Displays the command's parameter setting dialog box and allows the user to alter the parameters. |
|
Work | Do some work. If the command does not finish the work, return kAVCommandWorking. If the command finishes the work, return kAVCommandDone. If the user cancels the operation, return kAVCommandCanceled. If an error occurs, return kAVCommandInError. In most cases the work procedure will be called until you return kAVCommandDone, but in some cases, you may be called upon to Cancel or Reset before the work is done. |
|
Cancel | Stop working and pretend it reached a point where all work was done. |
|
Reset | Stop working, clear any errors, and try to get back into a ready state. For many commands this is equivalent to cancelling. |
|
PreflightSequence | See the sequence description in the callback reference. |
|
PreflightFile | See the sequence description in the callback reference. |
|
PostflightFile | See the sequence description in the callback reference. |
|
PostflightSequence | See the sequence description in the callback reference. |
|
reserved | Reserved for internal use. It must be |
AVCommandCancelProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandCancelProc)(AVCommand cmd)
Stop working and clean up as though the command executed to completion.
See Also
File: AVExpT.h |
Line: 9085 |
AVCommandCreatedProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
void (*AVCommandCreatedProc)(AVCommand cmd)
Called after a command is created. The command handler can establish default parameters and so forth for the newly created command.
See Also
File: AVExpT.h |
Line: 9007 |
AVCommandDestroyProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
void (*AVCommandDestroyProc)(AVCommand cmd)
Called before a command is destroyed. The command handler should free any memory allocated by the command.
See Also
File: AVExpT.h |
Line: 9017 |
AVCommandGetProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Retrieves a cabinet from a command. It is used in the GetParams
and GetProps
members of the AVCommandHandlerRec structure. When retrieving command parameters, the handler should first remove any existing items from theCab
using ASCabMakeEmpty(), and then copy all parameter values from the command into theCab
. When retrieving properties, the command handler should replace any entries in theCab
with key names it recognizes with copies of the command-specific properties.
File: AVExpT.h |
Line: 9047 |
AVCommandPostflightFileProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandPostflightFileProc)(AVCommand cmd, PDDoc doc)
Every command in a sequence has its Postflight
command callback called after all commands in a given sequence have been executed but before the file is closed.
Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).
See AVCommandPreflightSequenceProc() for the order in which the AVCommand Pre/Postflight callbacks are called.
File: AVExpT.h |
Line: 9179 |
AVCommandPostflightSequenceProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandPostflightSequenceProc)(AVCommand cmd)
Every command in a sequence has its Postflight
command callback called after the sequence is executed.
Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).
See AVCommandPreflightSequenceProc() for the order in which the AVCommand Pre/Postflight callbacks are called.
File: AVExpT.h |
Line: 9200 |
AVCommandPreflightFileProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandPreflightFileProc)(AVCommand cmd, PDDoc doc)
Every command in a sequence has its Preflight
callback called after each file has been opened to be processed but before any commands have been executed on that file. If any of the Preflight
callbacks returns an error, the sequence is aborted.
Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).
See AVCommandPreflightSequenceProc() for the order in which the AVCommand Pre/Postflight callbacks are called.
File: AVExpT.h |
Line: 9156 |
AVCommandPreflightSequenceProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandPreflightSequenceProc)(AVCommand cmd)
Every command in a sequence has its Preflight
callback called before the sequence is executed. If any of the Preflight
callbacks returns an error, the sequence is aborted.
Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).
Sequence Begins
AVCommandPreflightSequenceProc() for all commands are called
Open File # 1
AVCommandPreflightFileProcs() for all commands are called
Execute all commands on given file
AVCommandPostflightFileProcs for all commands are called
Close File # 1
Open File # 2
... (repeat pre/post file procs)
Close last file
AVCommandPostflightSequenceProcs for all commands are called.
Sequence ends
File: AVExpT.h |
Line: 9131 |
AVCommandResetProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandResetProc)(AVCommand cmd)
Stops working, clears any errors, and tries to get back into a Ready state. For many commands this is equivalent to cancelling.
See Also
File: AVExpT.h |
Line: 9097 |
AVCommandSetProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandSetProc)(AVCommand cmd, ASCab cab)
Called to set a cabinet within a command. It is used in the SetParams
member of the AVCommandHandlerRec structure. The command handler should copy any information from the cabinet into the command. It must not destroy or modify the cabinet.
See Also
File: AVExpT.h |
Line: 9031 |
AVCommandShowDialogProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandShowDialogProc)(AVCommand cmd)
Displays the command's parameter setting dialog box and allows the user to alter the parameters.
File: AVExpT.h |
Line: 9057 |
AVCommandWorkProc |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus (*AVCommandWorkProc)(AVCommand cmd)
Do some work. If it does not finish its work, return kAVCommandWorking. If it does finish its work, return kAVCommandDone. If the user cancels the operation, return kAVCommandCanceled. If an error occurs, return kAVCommandInError.
In most cases this method performs its work until it returns kAVCommandDone, but in some cases it may be called on to cancel or reset before its work is done.
See Also
File: AVExpT.h |
Line: 9074 |
AVCommandCancel | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandCancel(AVCommand cmd)
Cancels the specified command. If the command is currently processing a file, the command might not attempt to roll back any modifications it has made to the document. This may leave the PDF in an invalid state.
Parameters
cmd — | The command to cancel. See AVCommand Descriptions (Built-in Commands). |
The current status of |
See Also
Since
File: AVProcs.h |
Line: 5023 |
AVCommandDestroy | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
void AVCommandDestroy(AVCommand cmd)
Destroys the specified command and its associated resources.
Parameters
cmd — | The command to destroy. See AVCommand Descriptions (Built-in Commands). |
See Also
Since
File: AVProcs.h |
Line: 4662 |
AVCommandExecute | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandExecute(AVCommand cmd)
Runs the specified AVCommand, after it has been set up using AVCommandSetInputs() and AVCommandSetParams().
The method runs the command using the following process:
Reset the command if its status is not AVCommandReady.
If only a PDDoc input has been configured, AVCommandExecute() does nothing to the inputs. If no AVDoc or PDDoc inputs have been configured, AVCommandExecute() configures the command to use the active AVDoc. In all cases, if an AVDoc has been configured (either by AVCommandExecute() or its caller) the implementation ensures that the PDDoc input matches the AVDoc input.
If the command can display a dialog box (that is, if the command handler has a ShowDialog
callback and the command's kAVCommandKeyCanShowDialog property is true
), present the dialog box to allow the user to alter the command's parameters.
Repeatedly call AVCommandWork() on cmd
until that method returns a status other than kAVCommandWorking.
This method should be used when the client does not need the level of control provided when calling AVCommandWork() directly. Specifically, this method is useful for using a global command from within a menu or a toolbar button's execution procedure.
Parameters
cmd — | The command to execute. See AVCommand Descriptions (Built-in Commands). |
The current status of cmd. |
See Also
Since
File: AVProcs.h |
Line: 5224 |
AVCommandGetAVDoc | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Retrieves the AVDoc from a command's inputs ASCab.
Parameters
cmd — | The command to be queried. See AVCommand Descriptions (Built-in Commands). |
See Also
Since
File: AVProcs.h |
Line: 5071 |
AVCommandGetCab | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Returns the ASCab stored in the specified command under the key. If the cabinet is not available, this method will create it if create
is set to true
. The command retains ownership of the returned cabinet.
This method can only be exercised by an AVCommandHandler. Command handlers can use this call to attach arbitrary information to a command. Only the command handler should access these cabinets. See AVCommandSetInputs() and AVCommandSetParams().
Parameters
cmd — | The command to be queried. See AVCommand Descriptions (Built-in Commands). |
|
cabName — | The key under which the cabinet is stored. |
|
create — | Pass |
See Also
Since
File: AVProcs.h |
Line: 4702 |
AVCommandGetCancelProc | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
ASCancelProc AVCommandGetCancelProc(AVCommand cmd)
Returns a cancellation procedure for the command. If the user interface policy is anything other than kAVCommandUIInteractive, this cancellation procedure must be used. If the user interface policy is kAVCommandUIInteractive, an appropriate default cancel proc will be provided, but the command may use a more appropriate one it if preferred. Pass in the command itself as the client data.
Parameters
cmd — | The command whose cancellation procedure is returned. See AVCommand Descriptions (Built-in Commands). |
The cancellation procedure. |
Since
File: AVProcs.h |
Line: 5131 |
AVCommandGetConfig | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Retrieves the configuration parameters for the specified command.
Configuration values are controlled by the mechanism that is driving the command, such as a client or the batch framework. For example, one configuration value determines whether to display a dialog box while executing; it can be a setting that the user can toggle through the user interface, or a client can set it through AVCommandSetConfig().
To retrieve all the configuration parameters, pass in an empty cabinet for config
and the method will fill in the cabinet with the current configuration keys and values. To retrieve specific configuration parameter values, fill the initial dictionary with the keys in which you are interested, each with a NULL
value, and the method will attempt to fill in the appropriate value for each key.
Currently the only configuration parameters defined are:
Parameter |
Description |
---|---|
|
The local user interface policy for this command. |
|
Indicates whether the description of this command's parameters is visible in the sequence view. |
Parameters
cmd — | The command whose configuration parameters are being retrieved. See AVCommand Descriptions (Built-in Commands). |
|
config — | (Filled by the method) An ASCab into which the parameters are written. |
See Also
Since
File: AVProcs.h |
Line: 4840 |
AVCommandGetInputs | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Retrieves the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. The contents of the cabinet are dependent on the mechanism through which the command is initialized.
The batch framework attempts to provide the following:
Key (see Command Keys) |
Stored As |
Description |
---|---|---|
kAVCommandKeyPDDoc |
kASValuePointer |
The document being processed. |
kAVCommandKeyBaseFileName |
kASValueString |
The name of the input file, without extension. |
kAVCommandKeyOrigExtension |
kASValueString |
The extension of the input file. |
Clients should also attempt to provide this information. The content of the inputs
cabinet is not limited to the keys listed above. Clients (or the command handler itself ) can specify additional inputs as necessary. The caller retains ownership of inputs
.
Parameters
cmd — | The command whose input parameters are being retrieved. See AVCommand Descriptions (Built-in Commands). |
|
inputs — | (Filled by the method) The input parameters. |
See Also
Since
File: AVProcs.h |
Line: 4968 |
AVCommandGetName | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Returns the name of the command.
Parameters
cmd — | The command whose name is returned. See AVCommand Descriptions (Built-in Commands). |
Since
File: AVProcs.h |
Line: 4671 |
AVCommandGetParams | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Retrieves the parameter set for the specified command. It is possible that some commands have no parameters that can be configured, in which case no data will be written to params
. The params
cabinet should be empty when passed in. Upon return, it will be filled with copies of all of the command's parameter settings.
The caller retains ownership of params
.
Parameters
cmd — | The command whose parameters are being retrieved. See AVCommand Descriptions (Built-in Commands). |
|
params — | (Filled by the method) An ASCab into which the parameter set is written. |
See Also
Since
File: AVProcs.h |
Line: 4771 |
AVCommandGetPDDoc | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Retrieves the PDDoc from a command's inputs ASCab.
Parameters
cmd — | The command to be queried. See AVCommand Descriptions (Built-in Commands). |
Since
File: AVProcs.h |
Line: 5080 |
AVCommandGetProgressMonitor | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
ASProgressMonitor AVCommandGetProgressMonitor(AVCommand cmd)
Returns a progress monitor the command can use to report progress. The command itself should be passed in as the clientData
associated with the monitor's callbacks.
Command handlers should use this progress monitor rather than a custom implementation.
If the command is driven by the batch framework, the progress monitor updates the batch progress dialog box. If the command is driven by a client and the AVDoc input key has been set, the progress monitor updates the progress pane at the bottom of the document's window; otherwise, the progress monitor's callbacks are no-ops.
Parameters
cmd — | The command to be queried. See AVCommand Descriptions (Built-in Commands). |
The command progress monitor. |
Since
File: AVProcs.h |
Line: 5115 |
AVCommandGetProps | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Retrieves the properties of the specified command. Properties are values intrinsic to the command or to the command's current state.
To retrieve properties, create a cabinet containing the keys for the properties in which you are interested (the values should be invalid, such as NULL
), and pass it into this method. The command will copy the requested properties into your cabinet. If the cabinet is empty, the command will fill in all properties.
The following properties are pre-defined:
Property |
Description |
---|---|
|
Indicates that the command can show a configuration dialog box. Support of this property is optional; it defaults to |
|
Indicates that the command can provide a description of its parameters. Support of this property is optional; it defaults to |
|
A cabinet containing numeric keys (for example, '1', '2', ..., 'n' with kASValueText values describing the command's parameters). The text items will be displayed in the sequence dialog box in the numerical order of the keys. |
|
Indicates that the command should appear in the list of commands that can be batched. Support of this property is optional; it defaults to |
|
The name of the group to which this command belongs. Currently the |
|
The generic name for this command (for example, |
|
The specific title for this command (for example, |
Parameters
cmd — | The command whose properties are being retrieved. See AVCommand Descriptions (Built-in Commands). |
|
props — | (Filled by the method) The command properties. The caller retains ownership of the ASCab. |
Since
File: AVProcs.h |
Line: 4898 |
AVCommandGetReportProc | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
ASReportProc AVCommandGetReportProc(AVCommand cmd)
Returns the ASReportProc associated with the specified command. AVCommandHandlers should report all error and status messages through this procedure.
Pass the AVCommand itself as the clientData
parameter when calling the procedure.
Parameters
cmd — | The command whose ASReportProc is returned. See AVCommand Descriptions (Built-in Commands). |
The ASReportProc. |
Since
File: AVProcs.h |
Line: 5094 |
AVCommandGetStatus | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandGetStatus(AVCommand cmd)
Returns the current status of the specified command.
Parameters
cmd — | The command whose status is returned. See AVCommand Descriptions (Built-in Commands). |
The current status of cmd. |
Since
File: AVProcs.h |
Line: 4680 |
AVCommandGetUIPolicy | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandUIPolicy AVCommandGetUIPolicy(AVCommand cmd)
Retrieves the user interface policy that the command will respect while it is executed. The user interface policy is determined by a combination of the command's configuration and the context in which the command is executing (for example, a batch sequence).
Parameters
cmd — | The command whose user interface policy is returned. See AVCommand Descriptions (Built-in Commands). |
The user interface policy. |
See Also
Since
File: AVProcs.h |
Line: 5055 |
AVCommandNew | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Creates a new command of the specified type. An AVCommandHandler for that command type must have already been registered. See AVCommand Descriptions (Built-in Commands) for the names and parameters of built-in commands, as defined in AVCmdDefs.h.
Parameters
name — |
The new command, or |
See Also
Since
File: AVProcs.h |
Line: 4652 |
AVCommandPutCab | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
Stores a cabinet in the specified command. If a cabinet is currently stored under the key, it is overwritten. The command assumes ownership of cabVal
.
This method can only be exercised by an AVCommandHandler. Command handlers can use this call to store state information (such as parameters) in a command. Only the command handler associated with the command should access these cabinets. See AVCommandSetInputs() and AVCommandSetParams().
Parameters
cmd — | The command. See AVCommand Descriptions (Built-in Commands). |
|
cabName — | (May be |
|
cabVal — | (May be |
See Also
Exceptions
Since
File: AVProcs.h |
Line: 4726 |
AVCommandReset | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandReset(AVCommand cmd)
Resets the specified command. The command is expected to clean up its current state and assume a ready state.
If the command is currently processing a file, the command might not attempt to roll back any modifications it has made to the PDF. This may leave the PDF in an invalid state.
Parameters
cmd — | The command to reset. See AVCommand Descriptions (Built-in Commands). |
The current status of |
See Also
Since
File: AVProcs.h |
Line: 5040 |
AVCommandSetConfig | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandSetConfig(AVCommand cmd, ASCab config)
Sets the configuration for the specified command. See AVCommandGetConfig() for more information.
config
will be merged with the current configuration cabinet to generate the new configuraton. To erase configuration settings, set their values to NULL
in your cabinet.
Currently the only configuration parameters defined are:
Parameter |
Description |
---|---|
|
The local user interface policy for this command. |
|
Indicates whether the description of this command's parameters is visible in the sequence view. |
The caller retains ownership of config
.
Parameters
cmd — | The command whose configuration parameters are being set. See AVCommand Descriptions (Built-in Commands). |
|
config — | The configuration settings. |
The current status of |
See Also
Since
File: AVProcs.h |
Line: 4799 |
AVCommandSetInputs | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandSetInputs(AVCommand cmd, ASCab inputs)
Sets the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. Use this method and AVCommandSetParams() to set up a command before calling AVCommandExecute() to execute it.
A command handler should provide at least the following information:
Key (see Command Keys) |
Stored As |
Description |
---|---|---|
kAVCommandKeyPDDoc |
kASValuePointer |
The document being processed. |
kAVCommandKeyBaseFileName |
kASValueString |
The name of the input file, without extension. |
kAVCommandKeyOrigExtension |
kASValueString |
The extension of the input file. |
The command handler can specify additional inputs as necessary. The caller retains ownership of inputs
.
Parameters
cmd — | The command whose inputs are being set. See AVCommand Descriptions (Built-in Commands). |
|
inputs — | The input parameters. |
The current status of |
See Also
Since
File: AVProcs.h |
Line: 4934 |
AVCommandSetParams | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandSetParams(AVCommand cmd, ASCab params)
Sets the parameters for the specified command. The parameters are those pieces of information that can be controlled by the user, such as the pages to act on. Use this method and AVCommandSetInputs() to set up a command before calling AVCommandExecute() to execute it.
Setting any parameters for a command sets all parameters. The command supplies appropriate default parameters for any that are missing from params
. Passing an empty cabinet causes all parameters to be set to their default values.
If the command is not in a ready state, the parameters are not updated.
The caller retains ownership of params
.
Parameters
cmd — | The command whose parameters are being set. See AVCommand Descriptions (Built-in Commands). |
|
params — | The parameters to be set. |
The status of |
See Also
Since
File: AVProcs.h |
Line: 4753 |
AVCommandShowDialog | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandShowDialog(AVCommand cmd)
Instructs the command to bring up its configuration dialog box and gather parameter information from the user. The dialog box is shown regardless of the UIPolicy
of the command.
If the user confirms the configuration dialog box, the cmd
object's parameter set is updated; otherwise cmd
will enter a cancelled state.
Query cmd
for its kAVCommandKeyCanShowDialog property using AVCommandGetProps() to determine whether it has a configuration dialog box.
Parameters
cmd — | The command for which the dialog box is thrown. See AVCommand Descriptions (Built-in Commands). |
The current status of |
Since
File: AVProcs.h |
Line: 4986 |
AVCommandWork | () |
Product availability: Acrobat, Reader |
Platform availability: Macintosh, Windows, UNIX |
AVCommandStatus AVCommandWork(AVCommand cmd)
Instructs the command do some work based on its current parameters.
A command will either divide its processing across multiple AVCommandWork() calls, or perform all the processing within a single call.
If cmd
is in a working state upon return, it is the client's responsibility to poll the command's cancel proc, before calling AVCommandWork() again, to continue processing.
Parameters
cmd — | The command that is instructed to do some work. See AVCommand Descriptions (Built-in Commands). |
The current status of |
See Also
Since
File: AVProcs.h |
Line: 5008 |