I have numerous (over 1000) PDFs that need to be regenerated from DOCXs after the documents are modified. ISettings properties: (all Boolean except as noted) GetDefaultConversionSettings (byref settings as AdobePDFMakerForOffice.ISettings) GetCurrentConversionSettings (byref settings as AdobePDFMakerForOffice.ISettings) Here's the list, though I can't guarantee its accuracy - I might have mistyped:ĬreatePDFEx (settings as AdobePDFMakerForOffice.ISettings, retval as Long) Note that Intellisense and the object browser can show you all of the available properties and methods of pmkr and stng. If the output file cannot be created (permissions, read-only, open etc) CreatePDFEx does not throw an error. The steps of deleting the pdf file if it exists before converting and checking for the file after conversion are necessary. MsgBox "Could not create " & pdfname, vbOKOnly, "Conversion failed" If Dir(pdfname) = "" then ' see if conversion failed Pmkr.CreatePDFEx stng, 0 ' perform conversion Stng.AddBookmarks = True ' make desired settings Pdfname = IIf(i = 0, pdfname, Left(pdfname, i - 1)) & ".pdf" Pdfname = ActiveDocument.FullName ' construct output name MsgBox "Cannot Find PDFMaker add-in", vbOKOnly, "" If InStr(UCase(a.Description), "PDFMAKER") > 0 Then Set pmkr = Nothing ' locate PDFMaker object MsgBox "You must save the document before converting it to PDF", vbOKOnly, "" ' to a PDF file, in the same folder as the documentĭim pmkr As AdobePDFMakerForOffice.PDFMakerĭim stng As AdobePDFMakerForOffice.ISettings ' ConvertToPDFWithLinks - convert the current document \Program Files\Adobe\Acrobat 8.0\PDFMaker\Office. Before you can run it, you must open the Word macro editor and using Tools > References, add a reference to your copy of AcrobatPDFMakerForOffice.tlb, in e.g. After making any other desired setting changes, use the PDFmaker object's CreatePDFEx property to perform the conversion. Set property OutputPDFFilename to the desired PDF filename, and property PromptForPDFFilename to False. From that, use the GetCurrentConversionSettings (or GetDefaultConversionSettings) method to get an ISetting object. To script a conversion that doesn't require user intervention, get a reference to the PDFMaker add-in object from Word. In any case, since I haven't seen this explained anywhere it might be useful to post some notes here. If there is a better, documented way please let me know by responding to this note! It would be pretty peculiar for this not to be documented since as far as I can tell, this is the only way to create PDF files from Word documents with functional intra- and inter-document hyperlinks. I'd still appreciate any pointers anyone could give me to the documentation for the AdobePDFMakerForOffice.PDFMaker object. I have found enough information to script the conversion, but not the actual documentation.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |