![]() |
FREE Download | Purchase pdfMachine |
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.
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 a 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.
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.
This must be registered by executing the following command:
bgsview.exe -RegServer
bgsview.exe is found in the printer driver
directory, something like:
c:\windows\system32\spool\drivers\w32x86\2\bgsview.exe - your actual system
directory 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.
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 :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/lettitle.asp
A script component is an XML file that includes the java script code implementing the "clicked" method.
<?xml version="1.0"?>
<component>
<registration
description="pdfMachineButton"
progid="pdfMachineButtonHandler.WSC"
version="1.00"
classid="{01bfd353-3a5f-420b-b671-8bc32115aecf}"
>
</registration>
<public>
<method name="clicked">
<PARAMETER name="buttonText"/>
<PARAMETER name="pdfMachine"/>
</method>
</public>
<script language="JScript">
<![CDATA[
var description = new pdfMachineButton;
function pdfMachineButton()
{
this.clicked = clicked;
}
// this function called whenever a custom button is clicked
function clicked(buttonText, pdfMachine)
{
if (buttonText == "Upload")
{
pdfMachine.saveAs("c:/x.pdf");
pdfMachine.exit();
}
}
]]>
</script>
</component>
The click handler was saved to the file pdfMachineButtonHandler.WSC and registered with the command :
regsvr32 pdfMachineButtonHandler.WSC