The code below allows you to print pdf documents which are on a web server to an attached or network printer. Under IIS 7 I found that you need to set up a user account with permissions for Acrobat Reader and printing which is then assigned to the Application Pool for the website. If you don't do this you will spend hours trying to figure out why your code won't print!

Written with help from a lot of blogs, forums and support pages.

<%@ Page Language="C#"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Text.RegularExpressions" %>
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace = "System.Web" %>
<%@ Import Namespace = "System.Web.Security" %>
<%@ Import Namespace = "System.Security.Principal" %>
<%@ Import Namespace = "System.Runtime.InteropServices" %>