Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing file name from Acrobat 1

Status
Not open for further replies.

DatabaseDude

Programmer
Nov 7, 2005
112
US
Most of the time, it seems as though we're sending things to PDFs. Well, this time it's somewhat the opposite :)

Here's the situation. A client wants to save scanned files as PDFs, and store the files in a database table. Since Access 2007 has the Attachment data type, that's what we're going to go with.

We know how to browse from an Access form, find a PDF (or other file) and save it to the table. However, we're wondering if there's a more automated way.

In order, here are the steps I envisioned:

1. Open Acrobat
2. Scan document(s)
3. Save as PDF
4. Get file name of PDF
5. Save PDF into Access table
6. Close Acrobat

The only steps that, to me, would matter in terms of automation are 3 and 4. (1, 5, and 6 would be gravy)

If there's an event in Acrobat that can be monitored -- when saving a file, communicate that file name to Access somehow -- that would be fantastic.

I've not yet found anything on this subject; most topics are for creating PDFs.

Thanks much in advance for any info or pointers towards resources.
 
Thinking ... perhaps save to a folder that could be monitored by Access using a timer event?
 
How is the file currently named? Automated through scanning or user types in? Could you create a form in Access, have user type in name of file, click button which runs Acrobat and the Scan and takes the name entered on the form to save in the Access Table?
 
The file is named by user typing it in.

I don't know if a button that commands Acrobat and its scanning process is possible: the idea is right along with what I had in mind initially, but I don't have any idea of how to work with the Acrobat object model, and check for things like user canceling scan (file therefore not saved) etc.
 
I think I might have an idea, but will have to test it tomorrow and let you know the result.
 
Would this work for you? First off, the file names that you are collecting, instead of attaching the file directly into access, could you hyperlink the file? This would save space in your db. The user would be able to open the pdf file by clicking on the hyperlink either on a form or directly from the table.

1. Have a form with text box for the user to enter the filename

2. Then in on click event of a button next to the text box. You could call the button "Scan with Acrobat". Insert the code to open Acrobat (If acrobat already open, then this would not open a new instance).
Code:
RetVal = Shell("C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe", vbMaximizedFocus)

3. Scan file

4. Save scan with default file name (in my test, this was untitled.pdf)

5. Switch back to access.

6. Have another button to "import" pdf, what this will actually do is rename the file untitled.pdf to the name the user called it in the original text box. Then you could also have code in here that would delete this record if the file is not found (as you mentioned when user cancells a scan).

Code:
Name "c:\temp\untitled.pdf" As "c:\temp\NowRenamed.pdf"

This is just a rough outline on how to do it. If you need further detail, let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top