Automate Document Conversion: SharePoint 2010 PDF Printer Guide
Legacy SharePoint 2010 environments often require robust automation to convert standard Office documents into PDF format. While SharePoint 2010 lacks a native, one-click “Save as PDF” architecture for all file types, administrators and developers can implement server-side PDF printers and automation services to handle high-volume conversions.
This guide outlines the primary methods to automate document conversion in SharePoint 2010, focusing on the native Word Automation Services and the integration of virtual PDF printers. Method 1: Using Native Word Automation Services
The most reliable, built-in way to automate PDF generation in SharePoint 2010 is through Word Automation Services. This standard Service Application converts Word documents (.doc, .docx) to PDF without requiring desktop applications or third-party printer drivers. Step 1: Enable the Service Application Open SharePoint 2010 Central Administration.
Under Application Management, click Manage service applications. Select New and click Word Automation Services.
Name the service, assign it to your application pool, and set the supported file formats. Step 2: Deploy a Conversion Script
Because Word Automation Services operates on a timer job, you must trigger conversions using PowerShell or a C# event receiver. Below is a PowerShell script to automate the conversion of a document library item: powershell
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue \(siteUrl = "http://yoursharepointsite" \)jobName = “PDF_Conversion_Job” \(inputFile = "http://yoursharepointsite/Shared Documents/Report.docx" \)outputFile = “http://yoursharepointsite/Shared Documents/Report.pdf” # Initialize the Word Automation Service Job \(job = New-Object Microsoft.Office.Word.Server.Conversions.ConversionJob(\)jobName) \(job.UserToken = (Get-SPWeb \)siteUrl).CurrentUser.UserToken \(job.Settings.OutputFormat = [Microsoft.Office.Word.Server.Conversions.SaveFormat]::PDF \)job.Settings.OutputSaveBehavior = [Microsoft.Office.Word.Server.Conversions.SaveBehavior]::AlwaysOverwrite # Add the file and start the job \(job.AddFile(\)inputFile, \(outputFile) \)job.Start() Use code with caution. Method 2: Integrating a Server-Side Virtual PDF Printer
Word Automation Services is limited strictly to Word files. If your SharePoint 2010 environment needs to convert Excel sheets, InfoPath forms, or HTML pages, you must install a server-side virtual PDF printer (such as Adobe PDF Printer, PDFCreator, or Bullzip) and interface with it via code. Architecture Warning
Important: Desktop PDF printers are not inherently designed for unattended server environments. To make this stable, the printer driver must support a “silent print” mode that bypasses user interface prompts and automatically saves files to a designated SharePoint watched folder. Implementation Steps
[SharePoint Library] ➔ [Event Receiver / Workflow] ➔ [Call Virtual Printer Command] ➔ [Output to PDF]
Install the Driver: Install the commercial virtual PDF printer driver on all SharePoint Web Front End (WFE) servers.
Configure Permissions: Ensure the SharePoint Application Pool identity has absolute read/write permissions to the printer registry keys and temporary local spool folders.
Configure Silent Printing: Set the driver default profile to “Auto-Save” and target a local transit directory (e.g., C:\PDF_Drop</code>).
Develop the Event Receiver: Write a SharePoint synchronous ItemAdded or asynchronous ItemUpdated event receiver in C#.
When a user uploads a non-Word file, the event receiver downloads the binary file stream to a temporary location, executes a command-line print verb using the virtual printer, and uploads the resulting PDF back to SharePoint. Best Practices for Automation
Schedule Off-Peak Batching: PDF rendering consumes significant CPU and memory. Configure your conversion timer jobs or PowerShell loops to run during low-traffic hours to prevent server performance degradation.
Define File Scope: Restrict the automation rules to specific content types or document libraries. Running a global event receiver across an entire farm will cause massive performance bottlenecks.
Plan for Metadata Retention: Converting a file to PDF usually creates a brand-new item. Ensure your automation scripts explicitly copy original SharePoint column metadata, authors, and creation dates from the source file to the new PDF file.
To help refine this implementation for your environment, please share:
The exact file formats you need to convert (Word, Excel, InfoPath, or HTML)
Your preferred automation trigger (PowerShell scripts, SharePoint Designer workflows, or C# code) The average daily volume of documents your system handles
Leave a Reply