Link to home
Start Free TrialLog in
Avatar of AlphaLolz
AlphaLolzFlag for United States of America

asked on

automating MS Word 2010 -> PDF

I understand that it is possible to have a PowerShell script automate MS Word to read an MS Word document from a folder and save it out as a PDF document (same name, different extension) without bringing up a user GUI (in order to run on a server).

We have a need to run a script like this via the scheduler (once / minute or in a loop) to convert MS Word documents (*.doc, *.docx) to PDF (any relatively current version) on a Windows 2008 R2 (64-bit) server image.

Does anyone have the time to provide a script that can do this?  The goal is something that we can have going unattended and is reasonably immune to "hanging".
ASKER CERTIFIED SOLUTION
Avatar of Joshua Grantom
Joshua Grantom
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlphaLolz

ASKER

This works great on my desktop (which is fine at this point).

Now I have to move on and get PPT to work.  Then onto getting these to run on a server.
Function to convert PPT files to PDF
http://pshscripts.blogspot.co.uk/2012/11/convert-pptxtopdfps1.html


Script to perform function from Thomas Lee's blog
http://tfl09.blogspot.com/2012/11/saving-powerpoint-slides-to-pdf-with.html
    $ipath = "E:\SkyDrive\PowerShell V3 Geek Week\"

    Foreach ($ifile in $(ls $ipath -Filter "*.pptx")) {
      # Build name of output file
      $pathname = split-path $ifile
      $filename = split-path $ifile -leaf
      $file     = $filename.split(".")[0]
      $ofile    = $pathname + $file + ".pdf"

      # Convert _this_ file to PDF
       Convert-PptxToPDF -ifile $ifile -OFile $ofile
    }

Open in new window