[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Adobe PDF Data to MS Access

Posted on 2013-12-05
2
Medium Priority
?
332 Views
Last Modified: 2013-12-25
This pdf file has two sections I would like to inquire about a solution to place the data into a database.

In section 2 it has product and ingredient info.  Because of this I am thinking this would make three tables in access.  

Table 1. Header info
Table 2. Product Info
Table 3. Product ingredient Info


Please advise with any ideas.  What I am trying to accomplish is importing hundreds of pdf files in this format into a database to do analysis rather than typing them in.

Any ideas will be appreciated.

Thanks
Test-Doc.pdf
0
Comment
Question by:MPDenver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 800 total points
ID: 39700618
You can do this manually by opening the PDF in Adobe Reader and Saving as Text, then import that Text file into Access. If you have hundreds of PDFs, however, that would be a time consuming task.

You cannot do this natively in Access VBA, unfortunately. You must use a 3rd party tool, like the Adobe SDK:

http://www.adobe.com/devnet/acrobat.html

There are also some other third party tools that might work:

http://www.foolabs.com/xpdf/download.html

xPDF converts a PDF to Text, so you could loop through all the files in a folder, convert the .PDF to .TXT and then use TransferText to move the data into your database.

You'd first create a Batch file that calls the xPDF utility, and then "run" that batch file for each PDF. The batch file would look like this:

@echo off
pdftotext.exe -layout %1

You'd then loop through the files, and call that batch file (let's name it ConvertPDF.bat):

Dim sFile As String
sFile = Dir("YOur Folder Directory here", "*.PDF")

Do Until Len(sFile) = 0
  ConvertPDF sFile
  Dir
Loop

Open in new window


After running this, you'll have a directory full of .txt files, so do the same basic thing:

Dim sTxt As String
sTxt = Dir("Your Folder Directory, "*.txt")

Do Until len(sTxt) = 0
  DoCmd.TransferText acImport, , "YourTable", sTxt
  Dir
Loop

See here for more info on TransferText: http://msdn.microsoft.com/en-us/library/office/ff835958.aspx

One caveat - xPDF can take a few moments to convert a PDF to Text, so you might want to put a "wait" function in. To do that:

Public Function Wait(NumSeconds As Integer)
  On Error Resume Next
  Dim dStop as Date
  dStop = DateAdd("s", NumSeconds, Now)

  Do While dStop < Now
     DoEvents
  Loop
End Function

Open in new window


You'd then call it like this:

Do Until Len(sFile) = 0
  ConvertPDF sFile
  Wait 5 '/ wait for 5 seconds
  Dir
Loop

Finally, you could combine the xPDF and TransferText, if you'd like, but that's another exercise ...
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 1200 total points
ID: 39707458
Do you have Adobe Acrobat? If so, you can automate it via Access VBA. I wrote a few tutorials that illustrate how you would integrate Acrobat via VBA (and JavaScript):

http://khkonsulting.com/2009/03/adobe-acrobat-and-vba-an-introduction/
http://khkonsulting.com/2009/03/acrobat-javascript-and-vb-walk-into-a-bar/
http://khkonsulting.com/2010/09/reading-pdf-form-fields-with-vba/

You would need the Acrobat SDK (which in this case is just documentation), which you can download for free from here: http://www.adobe.com/devnet/acrobat.html
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question