biopdf logo
Shortcuts

Customers

Download PDF Writer

Other Tools
Command line printing with Acrobat Wrapper

Awards & Press
PC Magazine

CHIP.de Online

CNet

ZD Net

XKnowledge

SnapFiles


Run a program after PDF creation

The three settings RunOnSuccess, RunOnError, and AfterPrintProgram can all run a custom program when the document creation process has finished.

The outcome of the process will influence which of the specified programs and command line arguments will be launched.

Common to all these settings is that they are accompanied by a couple of other settings that will modify their behavior. One of these settings will set the current directory of the executing process. Another will tell how the launched program will show up. It can run hidden, minimized or maximized.

Control Windows State and Current Directory

RunOnSuccess has the RunOnSuccessDir that specifies the current directory when launching the command line given in RunOnSuccess. It also has the RunOnSuccessMode setting, which will determine what the window state of the launched application will be. Both RunOnError and AfterPrintProgram have similar settings.

Specify the Full Path

When specifying the executable that is going to run it is a good idea to specify the full path of the executable surrounded by quotes. The full path is needed unless the system can find it using the PATH environment variable. Surrounding the full path by quotes makes it robust to path names containing spaces, which is quite common in names such as C:\Program Files.

Parameters

When you specify a command line to run you can use as set of parameters that contains information about the current PDF print job. These parameters are specified as %1..%3 and have the following meaning.

Parameter Value
%1 Full path of the created PDF file.
%2 Number of pages created.
%3 Number of files created. This is normally 1 but can vary if each page is saved in a separate file.
%4 Full path of the status file.

Example

Here is a little and maybe useful example of how you could set RunOnSuccess in your global.ini.

RunOnSuccess="C:\Windows\System32\compact.exe" /C "%1"
RunOnSuccessMode=hide


This will compact the created PDF file and minimize the space used on the disk drive.

AllowExecute Setting

Running programs after the PDF creation can have implications on the system security. Please read more about the AllowExecute setting, which is used when executing programs from shared or global configuration files.

32 Bit Context

Bear in mind that the specified command line is launched in a 32 bit context. This has no implications on which programs you can run on a 64 bit system. However, if you try to access a directory such as C:\Windows\System32 you will end up running a program in C:\Windows\SysWOW64. Accessing files in the C:\Windows\System32 folder on a 64 bit system requires that you use the file system redirector and specify C:\Windows\SysNative instead. For more information on this subject you should refer to the Microsoft documentation on file system redirection.

 
McAfee SiteAdvisor Norton Safe Web