Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I came across the above macro only recently (Nov 2013). I can confirm that it works with Acrobat XI. I now have a nice macro that recursively scans a set of subdirectories and converts all word documents meeting my specific naming criteria to pdf. Definitely a happy bunny so thanks to Brian.
Copy link to clipboard
Copied
This code works great. The only issue I am having is clearing up the objects. I run a loop that uses this code and have several acrodist.exe running in the background. Is there a way to clean up the pdfmaker objects to successfuly close acrodist.exe after each iteration? I have tried releasecomobjects and setting the objects to nothing but that has not worked for me.
Copy link to clipboard
Copied
Just try to remember the Acrobat add-in macro for MS Office is subject to Microsoft changes to MS Office and Adobe's updating to fix bugs and react to Microsoft's changing their products. What macros worked in MS Office 95 no longer work in MS Office 2010 because MS has changed the scripting language at least once. Also there is no requirement that Adobe keeps the same macro name for different versions of MS Office. Adobe has even changed the name of the executable exe file for Acrobat.
Copy link to clipboard
Copied
Humiro, before the sub ends you need to set the adobe objects to nothing:
Set pmkr = nothing
Set stng = nothing
that should do the trick
Copy link to clipboard
Copied
I realize this is a fairly old post, but it turned out to be exactly what I was looking for. I'd like to say thank you for putting together this sample as it got me closer to where I need to be very quickly!
Now, I do have one question. Out of the box, the sample Sub provided works, but I am having a problem where as soon as pmkr.CreatePDFEx is called, VBA execution is halted, and macros within the document are disabled. (So although PDF Maker runs, the VBA can't pick back up afterwards.) Is anyone familiar with why this might be happening, or if there's a fix for it? Thanks!
Copy link to clipboard
Copied
In case you missed it: it is and remains unsupported. As such it's undocumented and likely to change or vanish. So, happy it works for you, but don't make any promises about the future. For enterprise server use look at LiveCycle PDF Generator.
Copy link to clipboard
Copied
Caught that, yep! The reason I ask is that my current workplace has a process set in place where Word documents need to be processed with PDF Maker (in order to retain relative file links) and I was looking at a quick way to automate it. I was hoping that this would work as a temporary method until a better process can be adopted, but still haven't been able to get it to continue macro execution after invoking PDF Maker.
Copy link to clipboard
Copied
Thank you for your post. I have numerous (over 1000) PDFs that need to be regenerated from DOCXs after the documents are modified. These documents are located over many folders.
I am running Win 7 Pro, Word 2010 and Acrobat XI Standard. Like the previous poster, I have been unable to successfully execute pmkr.CreatePDFEx, but pmkr.CreatePDF works just fine. I believe the latter uses whatever conversion profile is selected in the preferences for PDFMaker for Word, which I have set to not prompt for the output PDF name (outputs to the same base name as the DOCX file). This will save me an amazing amount of time.
If I could figure out how to make Distiller work for this task, I would attempt that. I have been unable to find documentation to interface with Distiller, at least with Acrobat XI Standard. The ability to right-click on a DOCX and select "Convert to Adobe PDF" via Windows context menu would suffice if I could make that work in batch mode. Again, I think this is a feature only available in the Pro versions of Acrobat.
Copy link to clipboard
Copied
michaelm58012143 wrote
If I could figure out how to make Distiller work for this task, I would attempt that. I have been unable to find documentation to interface with Distiller, at least with Acrobat XI Standard. The ability to right-click on a DOCX and select "Convert to Adobe PDF" via Windows context menu would suffice if I could make that work in batch mode. Again, I think this is a feature only available in the Pro versions of Acrobat.
I can help you with this part: As was explained by TSN, Distiller by itself does not help you with converting from MS Word to PDF, but when you use the "Adobe PDF" printer, the MS Word document is actually converted to PostScript and then passed to Distiller in order to convert it to PDF. The only problem is that in order to automate this, you need to be able to "tell" Distiller what filename to use for the output file. How this is done is documented in the Acrobat SDK: Acrobat DC SDK Documentation
You would have to automate MS Word to open a document, and then print it to the "Adobe PDF" printer (after you set the registry keys required by this solution). A few years ago, I wrote a tutorial about how to do that in VBS: Prevent the Save Dialog when Printing to the Adobe PDF Printer
Copy link to clipboard
Copied
The "retVal" in the following command is used to specify the PDF specification.
pmkr.CreatePDFEx stng, 0 ' perform conversion
Here are the values I've been able to ID
0 seems to indicate the current specification (Adobe DC the value is 2)
7 Adobe 7 (1.6)
Copy link to clipboard
Copied
I've found this quite helpful as ExportAsFixedFormat in VBA can't or won't give a truly hi-res PDF like using "Create PDF" from the Acrobat ribbon. I am having a couple of problems with it though, if anyone using it successfully wants to weigh in:
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Sorry to kvetch, but do I understand correctly that Adobe removed this feature from Acrobat by declaring it unsupported. For years I've been able to generate documents programmatically and store them as PDFs, with hyperlinks intact, with "Application.Run MacroName:='AdobePDFMaker.AutoExec.ConvertToPDF'." Now this capability just disappears? I would never have upgraded from Acrobat 6 had I known this.
Copy link to clipboard
Copied
These feature wasn't supported.
Copy link to clipboard
Copied
Hmm. I can split hairs, too, so maybe the use of this macro by customers was never officially sanctioned or "supported" by Adobe. But Adobe itself created the ConvertToPDF macro, and shipped it and installed it on customer machines as part of Acrobat over several releases. In that context, to suddenly disable this function and say it was never supported seems a little misleading, no?
Copy link to clipboard
Copied
All supported interfaces are described in the Acrobat SDK. Including Distiller. But Distiller has only one job: converting PostScript to PDF. It doesn't read Word documents. It would read PostScript generated by printing to file, but when you use PDFMaker it does not use printing, or PostScript, or Distiller.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more