PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________

I am experiencing odd behavior from Acrobat 6, and wondering if it is
something in my code or a bug in Acrobat. Most likely the former ;-)

With some excellent feedback from this list, I was able to assemble the code
necessary to read a record from a SQL database, populate a PDF with the data
from that record, save the PDF and open it.

Here's the rub:
If I have Acrobat already open, it functions just fine. The PDF is created
and saved, and then opens with the data in the proper fields.

However, if Acrobat isn't open, the file is created and saved, but Acrobat
never opens. When I check the Task manager, Acrobat.exe is running and
taking up 40 megs of memory, but it never actually opens.

I am developing in VB 6 on Win2K. Test system is Windows XP. Acrobat 6
Professional.

Below is the code I use to create, save and open the form.  (I snipped out
the irrelevant stuff like opening the database, assigning values to fields,
etc. and tried to include just what is germane to the issue I'm
experiencing. If you need to see all of the code, I can send it offline.)



   '   Open the Client Information PDF file
    Set avDoc = CreateObject("AcroExch.AVDoc")
    bOK = avDoc.Open("c:\temp\ConsentForm.pdf", "Consent Form")

    '   If everything was OK opening the PDF, we now instantiate
    '   the Forms Automation object.
    If (bOK) Then
        Set formApp = CreateObject("AFormAut.App")
        Set acroForm = formApp.fields
    Else
        Set avDoc = Nothing
        MsgBox "Failed to open Consent Form. Aborting..."
        GoTo Cleanup
    End If

    '   Set the PDF Form field values
    '   with data from the returned record

    Set field = acroForm.Item("cCode")
    field.Value = UCase(Trim(rs("clinicNo")))
    field.PrintFlag = True

{SNIP the rest of the filed assignments)

        'Save the PDF
    Set pdDoc = avDoc.GetPDDoc
    bOK = pdDoc.save(1, "c:\temp\1234a.pdf")
    If bOK = False Then
        MsgBox "Unable to Save the PDF file"
    End If


        'Open the PDF
    Set avDoc = CreateObject("AcroExch.AVDoc")
    bOK = avDoc.Open("C:\temp\1234a.pdf", "Consent Form")
    MsgBox "OK"

I've checked the SDK, and my code seems to match their examples. I took the
original code from feedback that I got from this list that is currently
working for others.

Thanks once again in advance to anyone that can shed some light on this
issue.

Brent

____________________________________________
Alexandri
A division of breid, llc
[EMAIL PROTECTED]
(512) 716-0684
(508) 526-5565 - Fax
(512) 657-3291 - Mobile



To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

Reply via email to