Thursday, November 15, 2007
Customize Adobe PDF conversion from Microsoft Office (Word/Excel/PowerPoint) using Visual Basic Scripting (VBScript)
Print2PDF Server Edition and Print2PDF Conversion Server can be easily customized using Visual Basic Scripting (VBScript) to provide Adobe PDF conversion from Microsoft Office applications (Word, Excel, PowerPoint, Visio and Publisher). The integrated scripting engine allows anyone to quickly add custom logic into the PDF conversion process (e.g. mail merging, print comments, and more).
How the scripts work
The conversion engine is composed of multiple .vbs script files and one scripts.ini file that matches what file types will use what conversion script. All of these files can be opened and modified with a plain-text editor (e.g. Notepad). If you make any modification to these files, please make a backup copy of your work. Any future software upgrades will overwrite these files with the latest version.

Modifying the scripts
To add your custom code to a script, first open the scripts.ini file to see what script file you need to modify for the particular file type. Below is the description for Microsoft Word:
[Microsoft Word]
;Word 2000/2002/2003/2007
Script=Word.vbs
FileTypes=doc,docx,rtf,dot,dotx,dotm,wri,wpd
;ConversionTimeout=300
Open the Word.vbs file in your text editor and modify the code as needed. Below is an example of modifying the code to print the document properties from the Word document on the last page.

Testing the scripts with Convert2PDF
After you have modified the script file you can test your results using the Convert2PDF application. Just launch Convert2PDF, select the file(s) and click Convert. Your custom code will be executed for each file in the conversion process. Below is an example of the printed Word document with the document properties printed on the last page.

2 Responses

Where are these scripts? Are they available if we are using Print2PDF Server Edition?
Thanks,
Scripts are located at:
C:\Program Files\Software602\Print2PDF\Scripts
Scripts are used with Print2PDF Conversion Server as well as with Print2PDF Server Edition
If you use Print2PDF Server Edition use 7.0.07.1030 or newer build. We recommend using the latest build.