biopdf logo

Use COM automation to change PDF settings

This small sample shows how to change the user's PDF Printer settings. The example is based on a support request by a network manager who wants to make a specific setting when users log on.

The code below will change the standard watermark text for the user that runs the script.

VB Script Source Code

Rem -- This example will show you how to change a setting in the settings.ini file for the logged in user.
Option Explicit

Dim printername
Dim util, settings

Rem -- Create the COM helper object.
Set util = CreateObject("biopdf.PdfUtil")

Rem -- Create the COM settings object to control the printer.
Set settings = CreateObject("biopdf.PdfSettings")

Rem -- Change the value of printer name if you want to use another PDF printer
printername = util.DefaultPrinterName
settings.PrinterName = printername
settings.SetValue "WatermarkText", "New Watermark Text"

Rem -- Write settings to the settings.ini.
settings.WriteSettings False

WScript.Echo "Settings saved!"

 
McAfee SiteAdvisor Norton Safe Web