pdf writer  
    

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 NameTypeExample Value
extraButtons REG_SZUpload,Send to Jim
extraButtonsImageIdsREG_SZc:\upload.bmp,1
extraButtonsComHandlerREG_SZpdfMachineButtonHandler.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 IdImage Description
0Save As
1Send Email
2Edit
3Archive
4Options
5Help

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, something like:
c:\windows\system32\spool\drivers\w32x86\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.

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 :
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=""

>

</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