Planet PDF Forum Archive

Planet PDF ForumThis is from our 160,000 page PDF discussion forum archive one & two spanning 1999-2011. Use the filters on our Advanced Search page to search archive only. 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.


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
‘Printer = "PEERNET.DRV ePro 5.0" ‘ ALSO BBBOOOOOMBS

'Note The first page in a document is page 0 for OLE automation.
' from http://csis.pace.edu/~anderson/AIS/art1.html
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

DoEvents
Next

' Close this file
AcroExchAVDoc.Close True

End Function


PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist 11

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

Two Passwords Are Better Than One: The Low-Down On PDF Security

For people who don't spend their time looking at PDF files in text editors*, PDF security is a sometimes misunderstood beast.

For example, those document restrictions that PDF files sometimes have -- no Printing, Content Copying, Page Extraction, etc -- are essentially useless unless the PDF also has a User Password.

January 09, 2014
Platinum Sponsor



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

Debenu PDF Aerialist 11

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

Features

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.