WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Acrobat Viewer

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Automate Printing in Adobe Exchange

Keywords:     Automate Printing in Adobe   print a PDF file 

Print a PDF file:
pdf_file = "C:\Temp\Test.pdf"

adobe = ObjectCreate("AcroExch.app") ; create an application object
pddoc = ObjectCreate("AcroExch.pddoc") ; create an application object
printdoc = ObjectCreate("AcroExch.avdoc") ; create an application object

pddoc.open(pdf_file)
printdoc.open(pdf_file, "")

numpages = pddoc.GetNumPages() ; Page count
Message("Number of pages", numpages)

avdoc = adobe.getActiveDoc

;PrintPages: Prints a specified range of pages displaying a print dialog box. PrintPages always uses the default printer setting.
; Syntax
;   VARIANT_BOOL PrintPages(long nFirstPage,long nLastPage,long nPSLevel, long bBinaryOk, long bShrinkToFit);
; Parameters
;  nFirstPage: The first page to be printed. The first page in a PDDoc object is page 0.
;  nLastPage: The last page to be printed.
;  nPSLevel: Valid values are 2 and 3. If 2, PostScript® Level 2 operators are used. If 3, PostScript Language Level 3 operators are also used.
;  bBinaryOk: If a positive number, binary data can be included in the PostScript program. If 0, all data is encoded as 7-bit ASCII.
;  bShrinkToFit: If a positive number, the page is shrunk (if necessary) to fit within the imageable area of the printed page. If 0, it is not.
; Returns
;   0 if there were any exceptions while printing or if no document was open, -1 otherwise.

avdoc.PrintPages(0,numpages-1,2,0,0)


pddoc.close
adobe.CloseAllDocs()
adobe.exit ; exit the application

; Close object handles
pddoc = 0
printdoc = 0
adobe = 0

Article ID:   W15250
File Created: 2012:04:30:09:46:20
Last Updated: 2012:04:30:09:46:20