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.

Get Information about a PDF file

 Keywords:  ADOBE ACROBAT PDF PROPERTIES

Note: In order to use the OLE object made available by Acrobat Reader, you must have the full Acrobat product installed on your system. You need the Acrobat Viewer, PDF development too, and Acrobat Exchange to do OLE.

You can purchase an Acrobat Reader Integration license for $100.00 that allows you to develop "approved" plugins for the reader. If you have the full version of adobe installed, which is an OLE Server, you can make OLE calls to the Viewer/Reader by default.

The code below works if you have the full version of Adobe installed.

Here is an OLE reference page:

Interapplication Communication IACOverview

Sample code:


pdf_file = "C:\temp\invoice.pdf"
adobe = objectopen("AcroExch.app")      ; create an application object
pddoc = ObjectOpen("AcroExch.pddoc")
pddoc.open(pdf_file)
numpages = pddoc.GetNumPages()	      ; Page count
Message("Number of pages", numpages)

InfoValues = "Title,Subject,Author,Keywords,Creator,CreationDate,ModDate,Producer"
list = ""
for i = 1 to 8
GiField = ItemExtract(i, InfoValues, ",")
GiValue = pddoc.GetInfo(GiField)
list = StrCat(list,@tab,GiField, " = ",GiValue)
next
list = StrTrim(list)
list = StrReplace(list,@tab,@crlf)
Message("List of values",list)

ret = AskYesNo("New title?","Do you want to change the title?")
if ret == @yes
   mytitle = AskLine("New title?","Enter new title","")
   test = pddoc.SetInfo("Title", mytitle)	   ; Set new value in title
endif


PDPage = pddoc.AcquirePage(0)    ;	  
rect = PDPage.GetSize()
y = rect.y	    ; i.e. 792 -  11 inch at 72 pt per inch
x = rect.x	    ; i.e. 612 -  8.5 inch
Message("Size",StrCat("x = ",x,@crlf,"y = ",y))

pddoc.save(1, pdf_file)
pddoc.close
adobe.exit; exit the application

objectclose(pddoc)      ; close the application object
objectclose(pdpage)      ; close the application object
objectclose(rect)      ; close the application object
objectclose(adobe)      ; close the application object
exit


Article ID:   W15251
File Created: 2008:03:20:12:20:56
Last Updated: 2008:03:20:12:20:56