Erick's Blog
  • Home
  • Blog
  • Apps
    • Mortgage Calculator
  • PowerShell
    • Blog & Examples
    • Excel Reference
  • Windchill
    • Document Exporter
    • Document Worker
    • E.P.L.E.S.
    • Export Released
    • Property Checker
    • Windchill Business Analytics >
      • Part 01 - Program Logic
      • Part 02 - Getting Data with SQL Queries
      • Part 03 - Automating SQL Queries
      • Part 04 - Converting SQL Results to XML
      • Part 05 - Data Processing and Manipulation
      • Part 06 - Displaying XML in HTML
      • Part 07 - Auto Updating Displayed Data
      • Part 08 - Hosting Webpage with an Existing Apache Installation
      • Part 09 - Running Multiple Queries In Sequence
      • Part 10 - Calculating Data Trends
      • Part 11 - Making It Modular
    • Windchill Quick View
  • Reviews
  • Music
  • Contact

How to Convert Word Documents to PDFs with PowerShell

6/5/2016

1 Comment

 
Picture

I needed a way to generate PDFs of Word documents automatically for a custom Office worker I was making for Windchill.  The following script will show you the core code to due such a thing.
Summary:
The WordPDF script below automates the task of converting Word readable documents to PDFs.

Problem Overview:
For my Windchill Document Worker, I needed a way to convert Word documents to PDFs via the command line.  Using Word to do this would prevent any kind of format translation errors that are often in other free programs that can open Word documents.

Solution:
Apparently, this is a very easy thing to do so I will spare you the boring details and let the script speak for itself.

Tips:
You can easily add a ForEach loop to go through all documents in a given directory and convert them to PDFs.  I didn't need to do such a thing for my purposes as I am only provided a single file at a time so I will leave that little piece up to you to figure out. =)
WordPDF.ps1

    
1 Comment
Amr Al-Omari
7/28/2019 04:11:47 am

Thanks for the cool guide

in any chance, is there a way that let me control the page size of the pdf?
I'm using it to convert automatically generated rtf files to pdf and I got an A4 page

Reply



Leave a Reply.

    Author

    PLM engineer while "on the clock", programmer, designer, dreamer all other times.

    Archives

    August 2016
    June 2016

    Categories

    All
    Cover Page
    Excel
    Office
    PDF
    PowerShell
    Reference
    Signature
    Watermark
    Word

    RSS Feed

Copyright © 2018 Erick Johnson
  • Home
  • Blog
  • Apps
    • Mortgage Calculator
  • PowerShell
    • Blog & Examples
    • Excel Reference
  • Windchill
    • Document Exporter
    • Document Worker
    • E.P.L.E.S.
    • Export Released
    • Property Checker
    • Windchill Business Analytics >
      • Part 01 - Program Logic
      • Part 02 - Getting Data with SQL Queries
      • Part 03 - Automating SQL Queries
      • Part 04 - Converting SQL Results to XML
      • Part 05 - Data Processing and Manipulation
      • Part 06 - Displaying XML in HTML
      • Part 07 - Auto Updating Displayed Data
      • Part 08 - Hosting Webpage with an Existing Apache Installation
      • Part 09 - Running Multiple Queries In Sequence
      • Part 10 - Calculating Data Trends
      • Part 11 - Making It Modular
    • Windchill Quick View
  • Reviews
  • Music
  • Contact