Ok, well your code works fine, creating three objects is not a problem if they are fast, unfortunately this code is very slow, for me it took 26 seconds to create PdDoc. Everything else runs well.
1 Hit 1st 26.530196 Avg 26.530196 oPdDoc = CREATEOBJECT("AcroExch.PdDoc")
For me you have a couple of options, one is to create the PdDoc object at another point where the wait is not so obvious, maybe on your main program at launch, or add I timer to your main program and set an interval to create the object after giving control back to the app.
Or you can open the pdf up low level and search for the info you need. Getting Title, creator, creation date and author is easy, not sure where to find the page count, but I am sure you can find it with a bit of looking, this would stop the need to create the object altogether.
/Title(Visual FoxPro)
/Creator(PScript5.dll Version 5.2)
/CreationDate(5/18/2002 13:46:38)
/Author(Administrator)>>endobj
Craig
> Sir
>
> Using Visual Foxpro 6.0, I need PDF information to be displayed on form using Messagebox. I wrote a code which is working very fine and giving me all information but the problem is that I used three classes instead of one. Can this be done using single class????????. The code is
>
> *code starts from here
> CLEAR
> SET DEFAULT TO C:\<br />> pdf_name="C:\SS.PDF"
> oFsO = CREATEOBJECT("Scripting.FileSystemObject")
> oFile = oFsO.GetFile(PDF_NAME)
> oPdDoc = CREATEOBJECT("AcroExch.PdDoc")
> oPdDoc.Open(PDF_NAME)
> AVDoc = CreateObject("AcroExch.AVDoc")
> AVDoc.Open(pdf_name,"")
> PDDoc = AVDoc.GetPDDoc
> pdf_title=PDDoc.GETInfo("Title")
> pdf_author=PDDoc.GETInfo("Author")
> pdf_key=PDDoc.GETInfo("Keywords")
> messagebox("Pdf Name : "+oFile.Name+chr(13)+;
> "PDF Title : "+pdf_title+chr(13)+;
> "PDF Author : "+pdf_author+chr(13)+;
> "PDF keywords : "+pdf_key+chr(13)+;
> "Date Created : "+dtoc(ttod(oFile.DateCreated))+chr(13)+;
> "Date Accessed : "+dtoc(ttod(oFile.DateLastAccessed))+chr(13)+;
> "Date Modified : "+dtoc(ttod(oFile.DateLastModified))+chr(13)+;
> "Size : "+str(oFile.SIZE())+chr(13)+;
> "Number of Pages : "+str(oPdDoc.GetNumPages))
> RELEASE oFsO
> RELEASE oPdDoc
> RELEASE AVDOC
> *code ends here
>
> to test this code just replace the ss.pdf with any other Acrobat file .
>
> When I run this program its takes few seconds to display required information. factually I have to integrate this code into form.
>
> thnx
> Rahul
>
rahulmahajans@rediffmail.com