Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Topic: How to set default printer in PDF and print PDF on
Conf: (P-PDF) Developers, Msg: 66844
From: wango
Date: 6/14/2002 05:37 AM

How to set default printer in PDF and print PDF one page at a time

The code below will print a PDF file to a tiff converter driver "PEERNET.DRV ePro 5.0" but I am prompted for a filename (a TIFF file) to print to.
I can only do this after setting "PEERNET.DRV ePro 5.0" as the default printer through the printer panel.

What I want is to be able to set the default printer programmatically, print all pdf file pages to individual TIFF pages (with individual names of course).

Lastly, reset the printer back to the original default printer.

(what is not declared here should be considered to be global)
Private Function GetImageFromPdf(strDirName As String, _
astrDestFolderName As String, _
astrFileName As String, _
strFileNameStem As String, _
imageType As String)

Dim fileFullPath As String

Dim AcroExchAVDoc As Object, AcroExchPDDoc As Object, _
AcroExchApp As Object

'Dim fileFullPath As String ', strPath As String
Dim iNumberOfPages As Integer

On Error GoTo HandleError

Set AcroExchApp = CreateObject("AcroExch.App")
Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
Set AcroExchPDDoc = CreateObject("AcroExch.PDDoc")

' must restore remed out for debugging multiselect
' when we open the file it will return true/false
fileFullPath = strDirName & "\" & astrFileName

'openResult = myPDFPageCount.Open(fileFullPath)

' Open the [strFileName] pdf file
' AcroExchAVDoc.Open strPath + strFileName, ""
AcroExchAVDoc.Open fileFullPath, ""

' Get the PDDoc associated with the open AVDoc
Set AcroExchPDDoc = AcroExchAVDoc.GetPDDoc

'SavePrinter = App.ActivePrinter ' works for MS Wordl for windows
' vbPRPSLegal is a constant for 8 1/2 x 14 in legal size
Printer.PaperSize = vbPRPSLegal

'AcroExch.avdoc.PrintPages 0, pddoc.GetNumPages - 1, 1, False, False

‘AcroExchApp.ActivePrinter = "PEERNET.DRV ePro 5.0" ‘ BBBOOOOOMBS

'Note The first page in a document is page 0 for OLE automation.
' from
For pagenumber = 0 To pageCount - 1

' Print all pages in this document
'AcroExchAVDoc.PrintPages 0, iNumberOfPages, POSTSCRIPT_LEVEL, True, False
AcroExchAVDoc.PrintPages pagenumber, pagenumber, POSTSCRIPT_LEVEL, _
True, False


' Close this file
AcroExchAVDoc.Close True

End Function

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.