Solved

vbscript Creating pdf printer port

Posted on 2008-10-28
2
622 Views
Last Modified: 2012-05-05
Need vbscript  for Creating pdf printer port. This is what I have so far. Assistance or different script is much appreciated.


WshShell.Run "regsvr32 /s \\ServerName\FolderName\Prnadmin.dll",1,TRUE
 

'************** Create the port first *******************************
 

dim oPort,objShell,oMaster,oPrinter,uProfile
 
 

set oPort = CreateObject("Port.Port.1")

Set objShell=CreateObject("WScript.Shell")

uProfile=objShell.ExpandEnvironmentStrings("%USERPROFILE%")
 

set oMaster = CreateObject("PrintMaster.PrintMaster.1")
 

oPort.PortName = uProfile
 

oPort.PortType = 4
 

oMaster.PortAdd oPort
 

if Err <> 0 Then
 

msgbox "There was an error creating the port."
 

end If
 

'********************************************************************
 

'************** Create the printer second ***************************

'Change MyPrinter to the name of the printer that you are adding.

'Change PrinterDriver to the name of the printer driver that you are adding.
 
 

set oPrinter = CreateObject("Printer.Printer.1")
 

oPrinter.PrinterName = "USPTO PDF Publisher"		' name of the printer as it appears in the Printers folder
 

oPrinter.DriverName = "Adobe PDF Converter"		' name that is referenced in ntprint.inf
 

oPrinter.PortName = "uProfile"		' Specify a port name. Can also point to LPT or COM port.
 

oMaster.PrinterAdd oPrinter

If Err <> 0 Then
 

msgbox "There was an error creating the printer."
 

end If
 
 

msgbox "The script is finished."

Open in new window

0
Comment
Question by:Inuyashapl
2 Comments
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 125 total points
Comment Utility
Why do you need to create a printer port? I assume that you want to create PDF documents programatically. There is a better (and documented) way to do that. Are you familiar with the Distiller API reference document?
0
 

Author Comment

by:Inuyashapl
Comment Utility
I need to create a seperate pdf printer object on pc's that already have adobe acrobat. My need for this is to setup a joboptions template different from adobe's standard for another type of pdf document creation.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Have you ever come up with a need of emailing only few pages of PDF file to one of yourfriend or colleague, instead of whole Adobe file? If yes, then surely you have face problems in doing that! Read this section as I have suggested multiple solutio…
In this third video of the Xpdf series, we discuss and demonstrate the PDFtoText utility, which converts PDF files into plain text files. Download and install the software.: You may have already downloaded and installed the Xpdf tools while watching…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now