![]() |
Customized pdfMachine Toolbar IconsWant 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 SettingsThe following registry key: HKEY_CURRENT_USER\Software\pdfMachine\BroadGun pdfMachine
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.
extraButtonsComHandler The name of the COM object that will be created. COM Interface - click handlerThe com interface defined by extraButtonsComHandler must support the IDispatch interface and define a method called "clicked". clicked (buttonText, pdfMachineviewer) buttonText pdfMachineviewer COM Interface - pdfMachine ViewerThis must be registered by executing the following command:
bgsview.exe is found in the printer driver directory, something like: 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 HandlerThis 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 : 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=""
>
</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 |
||||||||||||||||||||||||||
|
|