Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Topic: IAC: .Doc to PDF
Conf: (P-PDF) Developers, Msg: 95126
From: Allquixotic
Date: 8/26/2003 01:36 AM

When I try to run the following code from Visual Basic, the PDFMaker successfully initializes and the "Creating Adobe PDF" dialog/status bar comes up. But the status bar only reaches one "blip", the Acrobat window hangs for about a minute, and strangely enough, Word opens the document and gives programmatic control directly to the GUI without running the PDFMaker macro. The PDF is not successfully created after it's all done, and Word stays open. If I try to do this using "Open" in the Acrobat window (non-programmatically) everything works out fine - same machine, same Word installation etc. Is there something I'm missing? I've tried it with avApp locked and unlocked, and I've tried opening it as a PDDoc and as an AVDoc. The PDDoc doesn't even initialize the PDFMaker. Assume all file name calculations are correct, and disregard the DAO. I tried stepping through with debug mode and all the variables turn out right. This seems to be some sort of internal problem.

Private Sub Administer_Click()
Dim fa As String, ga As String, rs As Object
Set rs = Me.MailAttachments.Recordset
ga = InputBox("Enter the description for the new attachment.")
fa = FSQueryForFile(Me)
fn = Left(fa, InStr(1, fa, "."))
fn = Trim(Right(fn, Len(fn) - InStrRev(fn, "\")))
If MsgBox("Are you sure you want to add this entry to the list of attachments? This operation can only be reversed by an Administrator.", vbOKCancel, "Confirmation") = vbOK Then
rs.Fields(0) = ga
rs.Fields(1) = GSECURITY.getDrivePath & "System\" & fn & "pdf"
Set Me.MailAttachments.Recordset = Me.MailAttachments.Recordset

'Start paying attention here*******************
Dim avDoc As CAcroAVDoc, PDDoc As CAcroPDDoc, avApp As CAcroApp
Set avApp = CreateObject("AcroExch.App")
avApp.Lock "Subprocedure, Administer"
Set avDoc = CreateObject("AcroExch.AVDoc")
avDoc.Open(fa, "Wait")
Set PDDoc = avDoc.GetPDDoc
pdDoc.Save PDSaveFull, GSECURITY.getDrivePath & "System\" & fn & "pdf"
'Dereference avoids protection fault, lol
Set PDDoc = Nothing
Set avDoc = Nothing
Set avApp = Nothing
End If

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.