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!

Automate Adobe Acrobat "distiller" to save to new folder

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
0
36
US
using Adobe Acrobat 4.0
I create manuals for our company.
And I used Adobe and distiller alot. I need to automate the process. I managed to create a Visual Basic App to get AutoCAD to open a drawing, print it out to distiller, and close the drawing when done. But Now I would like Adobe Acrobat to save that new file into a particular folder. Not the Default.
In other words I want to control Acrobat somehow.

Any Ideas??? DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Unfortunately Acrobat doesn't have any automation.

Since you mentioned VB, Check out the SendKeys command. I have built a few tools over the years for Acrobat using VB and SendKeys. (Mostly to automatically build bookmarks or thumbnails)

The kicker is that the process takes over your machine. You have to let it run... when I first staring doing it (386 with 4MB ram) it would take about 40 minutes to build my bookmarks. Now with (P3-667 with 128MB) it takes about 30 seconds.) Wow has technology improved. Drop me an email blindpete@mail.com and I'll send you some sample code.
-Pete
 
This is the main procedure. It drives several other database related functions (not included)... all the bookmark "sendKeys" info is in here. We still use Acrobat 3 so some of the command structure may have changed... I just don't know.

I strongly recommend trying this technique on a small representative sample of your PDF. As it takes over your machine and halting the exe is problematic when using "sendKeys" in this way.

BTW I have sent Adobe several requests for information on automation over the years. I have only ever recieved canned replies. I guess they just don't get it.

Public Sub Bookmarks()
' 0) use the view.mde to filter out all but the mdesc records.
' 1) open ACROBAT EXCHANGE if not Already open by openning a
' PDF file.
' 2) Send commands to acrobat exchange for it to
' build index based on Mdesc section + " "+ desc
' 3) issue save command and exit ACROBAT EXCHANGE
Dim RStemp As Recordset
Dim DBview As Database
Dim toAcrobat, cLastSec, cThisSec As String
Dim myCount, recCount As Long
Dim chkAcrobat As Integer

' On Error GoTo errTrap
Set DBview = CurrentDb
Set RStemp = DBview.OpenRecordset("SELECT section, title FROM usc_spec ORDER BY section")
RStemp.Requery

Debug.Print DBview.Name, RStemp.RecordCount, RStemp!Section,

RStemp.MoveFirst
If vbOK = MsgBox("Open with ACROBAT EXCHANGE the *.PDF file you" + Chr(13) + "want to build an index for." + Chr(13) + Chr(13) + "Select OK when finished openning ACROBAT EXCHANGE and *.PDF file", vbExclamation + vbOKCancel, "USE THE START BUTTON TO:") Then
GoTo Begin
Else
MsgBox "Operation Canceled"
GoTo allDone
End If
Begin:
'make ACROBAT EXCHANGE current Application
AppActivate "Acrobat Exchange" 'error is trapped if not open
recCount = RStemp.RecordCount - RStemp.AbsolutePosition 'count of records
cLastSec = ""
cThisSec = ""
For myCount = 1 To recCount 'from current pos to end of set
cThisSec = Left(Trim(RStemp!Section), 2)
If cLastSec <> cThisSec Then
toAcrobat = newSpecDivision(cThisSec)
'find first division in heading
Debug.Print toAcrobat
SendKeys &quot;%{t}f&quot; + toAcrobat + &quot;%{f}&quot;, True 'search for division heading
SendKeys &quot;%{d}n&quot;, True 'create bookmark
End If
'Acrobat Exchange text search string
'these are dumb commands the program has no
'way of knowing if they were successfull.
'If an error occurs you will have to adjust the
'data and rebuild the Acorbat
toAcrobat = &quot;Section &quot; + Trim(RStemp!Section) + &quot; &quot; + Trim(RStemp!title)
'the ( char gives trouble when sending
chkAcrobat = InStr(1, toAcrobat, &quot;(&quot;)
If chkAcrobat > 0 Then
toAcrobat = Left(toAcrobat, chkAcrobat - 1)
End If
'the ) char gives trouble when sending
chkAcrobat = InStr(1, toAcrobat, &quot;)&quot;)
If chkAcrobat > 0 Then
toAcrobat = Left(toAcrobat, chkAcrobat - 1)
End If
toAcrobat = Trim(toAcrobat)
Debug.Print toAcrobat
SendKeys &quot;%{t}f&quot; + toAcrobat + &quot;%{f}&quot;, True 'search for spec and title
SendKeys &quot;%{d}n&quot;, True 'create bookmark
cLastSec = cThisSec 'update division check
RStemp.MoveNext
Next myCount
RStemp.Close
'AppActivate &quot;Make View Database&quot;
GoTo allDone:

errTrap:
Select Case Err.Number
Case 91
MsgBox &quot;File not open &quot; + Str(Err.Number) + Chr(13) + Chr(13) + Err.Description, vbOKOnly + vbCritical, &quot;You Must Open the View First&quot;
GoTo allDone
Case 5
MsgBox &quot;Application not open &quot; + Str(Err.Number) + Chr(13) + Chr(13) + Err.Description + Chr(13) + toAcrobat, vbOKOnly + vbCritical, &quot;You must have ACROBAT EXCHANGE running!&quot;
GoTo allDone
Case Else 'all other errors
MsgBox &quot;Unknown Error &quot; + Str(Err.Number) + Chr(13) + Chr(13) + Err.Description, vbOKOnly + vbCritical, &quot;Error mnuBuildAdobe&quot;
GoTo allDone
End Select

allDone: 'exit sub
End Sub

-Pete
 
I do a similar thing here at work, but the best way I found to completely automate it was to use AutoCAD to generate a Postscript file, and then process that using Distiller's automation capabilities.

This allows you to control the output file for Distiller.

It also means you have complete control of the application, and are not subject to the anything that users can do to affect your SendKeys commands.

It's a long time since I wrote the code, but if you want some sample code, post something here & I'll dig it out.


Nick
 
hgliu

Please mail me your address, so I can send the details.

It's a bit too big to post here

Nick

nick.hall@altasystems.co.uk
 
Hi Does anybody know How can i generate pdf file through xml or recordset using adobe distiller.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top