Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Printing PDF Files using OLE

Keywords: 	 printing PDF files

Question:

Does anyone have an example of how to print a PDF file using Winbatch?

Answer:

Working code!
pdf_file = "C:\Temp\Test.pdf"
adobe = objectopen("AcroExch.app") ; create an application object
pddoc = ObjectOpen("AcroExch.pddoc") ; create an application object
printdoc = ObjectOpen("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
avdoc.PrintPages(0,numpages,1,0,0)
pddoc.close
adobe.CloseAllDocs()
adobe.exit ; exit the application
objectclose(pddoc) ; close the application object
objectclose(adobe) ; close the application object
objectclose(printdoc) ; close the application object