Customized pdfMachine Toolbar Icons

Want to place your own buttons on the pdfMachine toolbar to do a specific job? Then read on. It involves creating a few registry entries and defining a COM object to be called when a button is clicked. This COM object could be developed in any Windows programming language or it may even be a script.

Registry Settings

The following registry key:

HKEY_CURRENT_USER\Software\pdfMachine\BroadGun pdfMachine
Value Name Type Example Value
extraButtons REG_SZ Upload,Send to Jim
extraButtonsImageIds REG_SZ c:\upload.bmp,1
extraButtonsComHandler REG_SZ pdfMachineButtonHandler.WSC

extraButtons

A comma separated list of button names.

extraButtonsImageIds

A comma separated list of image identifiers. An image identifier may be a file name or an index. If a file name the image file must be a 32x32 pixel BMP file.

Image Id Image Description
0 Save As
1 Send Email
2 Edit
3 Archive
4 Options
5 Help

extraButtonsComHandler

The name of the COM object that will be created.

COM Interface - click handler

The com interface defined by extraButtonsComHandler must support the IDispatch interface and define a method called "clicked".

clicked (buttonText, pdfMachineviewer)

buttonText

This is the text of the button that was clicked.

pdfMachineviewer

This is a COM object that supports the IDispatch interface exposing methods to the pdfMachine viewer application.

COM Interface - pdfMachine Viewer

This must be registered by executing the following command:

bgsview.exe -RegServer

bgsview.exe is found in the printer driver directory, which will be something like - depending on your operating system:
c:\windows\system32\spool\drivers\x64\3
c:\windows\system32\spool\drivers\w32x86\3
Your path may be different.

The pdfmachineViewer COM object implements an IDispatch interface that exposes the following methods:

saveAs(filename)

The PDF file will be saved under the file name 'filename'.

sendEmail()

The default MAPI mail client will open with the PDF file attached.

exit()

The pdfMachine viewer application will exit.

Example Click Handler

This click handler was created using the Microsoft "Windows Script Component Wizard".

Microsoft Windows Script Components provide you with an easy way to create COM components using scripting languages such as Microsoft Visual Basic Scripting Edition (VBScript) and Microsoft JScript. For more information on Script Components go to :
https://msdn.microsoft.com/en-us/library/aa902560.aspx

A script component is an XML file that includes the java script code implementing the "clicked" method.

Click here to download the pdfMachineButtonHandler.WSC  file

The click handler was saved to the file pdfMachineButtonHandler.WSC and registered with the command :

regsvr32 pdfMachineButtonHandler.WSC

On x64 systems, run the regsvr32.exe program from the syswow64 directory.

c:\windows\syswow64\regsvr32 pdfMachineButtonHandler.WSC