Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.)

share|improve this question
    
Office 2010 allows you to save as a PDF. What version of office are you using? –  Bryan Jan 24 '13 at 22:11

2 Answers 2

Use the command line ability of PDFCreator to convert any printable file to PDF

  1. Download and install PDFCreator together with its COM module. The COM module is important or else the following VBscript can not comunicate with your PDF printer

  2. Copy & paste this code to a text file and save it as Convert2PDF.vbs

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set PDFCreator = Wscript.CreateObject("PDFCreator.clsPDFCreator", "PDFCreator_")
    
    With PDFCreator
     ReadyState = 0
     .cStart "/NoProcessingAtStartup"
     .cOption("UseAutosave") = 1
     .cOption("UseAutosaveDirectory") = 1
     .cOption("AutosaveFormat") = 0
     .cOption("AutosaveStartStandardProgram") = 0
     DefaultPrinter = .cDefaultprinter
     .cDefaultprinter = "PDFCreator"
     .cClearcache
     .cPrinterStop = false
     .cOption("AutosaveDirectory") = fso.GetParentFolderName(WScript.Arguments(0))
     .cOption("AutosaveFilename") = fso.GetBaseName(WScript.Arguments(0))
     .cPrintfile cStr(WScript.Arguments(0))
      c = 0
      Do While (ReadyState = 0) and (c < 120)
       c = c + 1
       Wscript.Sleep 250
      Loop
     .cDefaultprinter = DefaultPrinter
     .cClearcache
     WScript.Sleep 200
     .cClose
    End With
    
    Public Sub PDFCreator_eReady()
     ReadyState = 1
    End Sub
    
  3. Place a shortcut to your VBscript in your shell:sendto folder for faster access

    enter image description here

    (or)

    Execute your VBScript from the command line if you want full control over the output file name.
    Use this slightly changed code for this.

     C:\Convert2PDF.vbs "C:\inputfile.doc" "C:\outputfolder" "outputfilename"
    
share|improve this answer
up vote 0 down vote accepted

I apologize for forgetting about this question but at least I am finally answering the question, right?

I could not find a way to accomplish this the way I wanted so I did a slight workaround. I created and compiled 2 separate .ahk (AutoHotkey) scripts and added them to the right click context menus.

Here are the scripts:

Convert .DOC and .DOCX to PDF (Requires Office 2007 or 2010)

; AutoHotkey Script by Cyborg v1.5

; This script is designed to be compiled and ran in the user's Send To Right-Click Menu.
; The user needs to right click a word document go into the send to menu and choose this
; script. After launching the script the selected file will open in its version of Word
; and open the menus to save it as a PDF. In this version the user is unable to rename the
; the file.

; NOTE: In order for this to work correctly with Office 2007 you MUST have already installed
; the PDF/XPS converter from Microsoft.

SetTitleMatchMode 2

Loop %0%
{
Path := %A_Index%
Run,% Path
}

IfWinExist, Microsoft Word
    WinActivate

sleep 1000

Word2007:
IfExist, C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE ; Microsoft Word 2007
{
    Send ^s
    Send !f
    Send f
    Send p
    Sleep 500
    Send {Enter}
    Sleep 500
    WinClose, Microsoft Word
}
else
{
    Goto, Word2010
}
return

Word2010:
IfExist, C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE ; Microsoft Word 2010
{
    Send ^s
    Send !f
    Send d
    Send p
    Send a
    Sleep 500
    Send {Enter}
    Sleep 500
    WinClose, Microsoft Word
}
else
{
    Goto, Word2013
}
return

Convert .XLS and .XLSX to PDF (Requires Office 2007 or 2010)

; AutoHotkey Script by Cyborg v1.5

; This script is designed to be compiled and ran in the user's Send To Right-Click Menu.
; The user needs to right click a word document go into the send to menu and choose this
; script. After launching the script the selected file will open in its version of Excel
; and open the menus to save it as a PDF. In this version the user is unable to rename the
; the file.

; NOTE: In order for this to work correctly with Office 2007 you MUST have already installed
; the PDF/XPS converter from Microsoft.

SetTitleMatchMode 2

Loop %0%
{
Path := %A_Index%
Run,% Path
}

IfWinExist, Microsoft Excel
    WinActivate

sleep 1500

Excel2007:
IfExist, C:\Program Files (x86)\Microsoft Office\Office12\EXCEL.EXE ; Microsoft Excel 2007
{
    Send ^s
    Send !f
    Send f
    Send p
    Sleep 700
    Send {Enter}
    Sleep 700
    WinClose, Microsoft Excel
}
else
{
    Goto, Excel2010
}
return

Excel2010:
IfExist, C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE ; Microsoft Excel 2010
{
    Send ^s
    Send !f
    Send d
    Send p
    Send a
    Sleep 500
    Send {Enter}
    Sleep 500
    WinClose, Microsoft Excel
}
else
{
    Goto, Excel2013
}
return

Excel2013:
    MsgBox, Excel 2013 Not Configured for this Script.
return

Once I wrote these scripts and compiled them into .exes I placed them into the SendTo by following this guide by HowToGeek.

You may also be able to apply each script to each filetype but I didn't look into that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.