Windows Explorer – Add Right-Click Save as PDF Option

autohotkeycontext menuconversionmicrosoft-officepdf

I'm looking for a way to be able to add some options to the Right Click Context menu in Windows 7. I really don't have much experience in programming much but I am very eager and willing to learn.

Specifically I'd like to be able to Right Click a word document and have it convert or save as a .PDF file. I want to be able to convert existing documents into PDF format. The documents are 99% of the time going to be Microsoft Word documents so if there is a way to automate that, guidance there is appreciated.

I'm aware there are other methods of doing this such as downloading a "PDF Printer" but I would rather avoid that method if I could. I would also like to avoid downloading more software to install on user's PC's if possible as well.

Hopefully I am not being very demanding but I really do appreciate any help or guidance you can offer.

(As a Bonus I'd like to see if I can also get the option to Saves as PDF and Send as an attachment if possible.)

Best Answer

Here is the solution for Word 2013. It involves only adding a Visual Basic macro to Word and few records to the registry.

Create a global macro in Word 2013: open any document in Word, open the built-in Visual Basic editor (Alt + F11), select Normal in the left panel, click Insert in the main menu, then Module, and copy the code into the editor:

Sub ExportToPDFext()
    ChangeFileOpenDirectory ThisDocument.Path
    ActiveDocument.ExportAsFixedFormat _
        OutputFileName:=Left(ActiveDocument.FullName, InStrRev(ActiveDocument.FullName, ".")) + "pdf", _
        ExportFormat:=wdExportFormatPDF, _
        OpenAfterExport:=False, _
        OptimizeFor:=wdExportOptimizeForPrint, _
        Range:=wdExportAllDocument, _
        From:=1, _
        To:=1, _
        Item:=wdExportDocumentContent, _
        IncludeDocProps:=True, _
        KeepIRM:=True, _
        CreateBookmarks:=wdExportCreateNoBookmarks, _
        DocStructureTags:=True, _
        BitmapMissingFonts:=True, _
        UseISO19005_1:=False
    Application.Quit SaveChanges:=wdDoNotSaveChanges
End Sub

Save the module (Ctrl + S) and close Visual Basic editor and Word.

Then add the context menu options to registry. Create and execute a file with the extension .reg:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Word.Document.8\shell\SavePDFhere]
@="Save PDF here"

[HKEY_CLASSES_ROOT\Word.Document.8\shell\SavePDFhere\command]
@="\"C:\\Program Files\\Microsoft Office\\Office15\\WINWORD.EXE\" /mExportToPDFext /q \"%1\""

[HKEY_CLASSES_ROOT\Word.Document.12\shell\SavePDFhere]
@="Save PDF here"

[HKEY_CLASSES_ROOT\Word.Document.12\shell\SavePDFhere\command]
@="\"C:\\Program Files\\Microsoft Office\\Office15\\WINWORD.EXE\" /mExportToPDFext /q \"%1\"" 

The right-click "Save PDF here" will appear in Explorer for DOC and DOCX files.

It works silently and supports batch conversion of several selected documents.

Related Question