Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to parse a PDF document?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00468693
Message ID:
00476380
Vues:
49
>>>>>>>>>Hi,
>>>>>>>>>
>>>>>>>>>I want to automate the loading of information contained in a PDF document to a database. Any easy ways to do this?
>>>>>>>>>
>>>>>>>>>Best Regards,
>>>>>>>>>
>>>>>>>>>J Miller
>>>>>>>>This will give an access to document's fields collection:
>>>>>>>>AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
>>>>>>>>AcroExchAVDoc.Open("pdfform.pdf", "")
>>>>>>>>AFormAut = CreateObject("AFormAut.App")
>>>>>>>>Fields = AFormAut.Fields
>>>>>>>>
>>>>>>>>You need a full version of Acrobat or Acrobat Business Tools.
>>>>>>>>Mark
>>>>>>>
>>>>>>>Hi Mark,
>>>>>>>
>>>>>>>I finally purchased version 4 of Acrobat. I've been perusing the documentation along with any docs I found on the Adobe site to give me better insight as to what I wanted to do with the PDFs.
>>>>>>>
>>>>>>>I downloaded and installed the Acrobat SDK. Is this a necessity to do what I describe above? Can you point me in the right direction as far as the documentation I need to read to continue on with the code segment that you shared above?
>>>>>>>
>>>>>>>Any help would be appreciated.
>>>>>>>
>>>>>>>John
>>>>>>
>>>>>>To do what you want with fields no SDK is needed. Acrobat SDK does not offer much more then you already have with a full version of the product. SDK in mainly for C++ developers who are developing Add-ons for Acrobat. In fact, Automation between VB (VFP) and Acrobat is limited comparing to what you can do using SDK (and C++). Remember, you cannot run Acrobat on the Web server to modify PDFs to send them out to client's browser.
>>>>>>HTH,
>>>>>>Mark
>>>>>
>>>>>
>>>>>Hi Mark,
>>>>>
>>>>>I went through just about all the Acrobat docs I could find on the Adobe site looking for a way to access the fields collection of a PDF. The code segment you gave me (which I tested and works great) stops short of how to actually start getting the data out of a PDF. Any further direction you could give me?
>>>>>
>>>>>Best Regards,
>>>>>
>>>>>John
>>>>
>>>>
>>>>To access existing fields you need to know their names:
>>>>?fields.Item('test').value
>>>>?fields.Item('test').type
>>>>
>>>>Mark
>>>
>>>
>>>Mark,
>>>
>>>That's the problem - I don't know their names. There are two PDF documents that I have created by another source. It contains information that I want to dig out and put into a database. If I don't know their names, is there a way to programmatically get them?
>>>
>>>Thanks for all your help. You've saved me much time so far.
>>>
>>>John
>>
>>
>>You can create a new pushbutton in the document you need to get fields from and add this LS code to mouse down actions:
>>
>>console.clear();
>>// Loop through collection of fields
>>for (var i = 0; i < numFields; i++)
>>{ var f_name = getNthFieldName(i);
>>var f = getField(f_name);
>>console.println("Field " + (i + 1) + ": " + f_name + " - " + f.type);
>>}
>>console.show();
>>
>>then copy and paste fields names. Still not a true Automation :((. Will let you know if I find anything else.
>>Mark
>>PS. No credits to me for a trick.
>
>
>Mark:
>
>Perfect! I owe you one!
>
>Thanks,
>
>John


Ok, here is an addition to my code:
For Each oField In Fields
?oField.name && or oField.text or any other existing property.
endfor

Mark
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform