New Forum | Previous | Next | (P-PDF) Developers
Topic: causes of file read errors from avdoc?
Conf: (P-PDF) Developers, Msg: 52228
Date: 5/29/2002 04:50 PM
I have a vb app which prints a report to distiller in order to convert it to pdf and then uses av and pddoc methods to append other similarly created pdf documents to the first one. Unfortunately it isn't as stable as i would like it to be. It seems as if calls to CreateObject aren't always working, but I'm not sure also even after I've called the exit method of the exchange object and closed all of its open windows i'll notice inside the NT task manager that the Acrodist.exe is still running. I don't know how to handle this error b/c sometimes if i simply restart my application I don't get all of the pages I'm supposed to get in the pdf. Here is some of my code:
If star Or core Then
file1 = "a" 'participant report
file1pdf = PRINTER_DEFAULT_PDF_NAME & "a.pdf"
WriteReport projid, file1
Set AVDoc1 = CreateObject("AcroExch.AVDoc")
AVDoc1.Open file1pdf, "Doc1" 'file1pdf did'nt get made/saved under that name
Set PDDoc1 = AVDoc1.GetPDDoc
ok = PDDoc1.Save(PDSaveFull, "c:\acrotest.pdf")
If Not ok Then
Debug.Print "problem with pddocsave"
my problem always seems to occur in the call to PDDoc save, which leads me to believe the CreateObject isn't working. The type of error I usually get are "file read error" or files doesn't exitst from Acrobat followed by Vb runtime error saying "object variable or with block variable not set.." It was suggested to me to just try using the PDDoc as you can test for its success or failure better like this:
set pddoc = CreateObject("AcroExch.PDDOC")
if pddoc.Open "my file" then
pddoc.Save1, "my file"
But my app never even got off the ground with this -- I'd immediately get the file read error or the file doesn't exist error. Please anybody help.