PDF Printing from a Server using C#

Code to enable PDF Printing from a Server using C#

Date 21 December 2010
Views 7,445
Time to read 1 minutes read

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" %>

Tags: Projects

Comments


Leave a comment

Your email address will not be published.

Please enter the text from the image below to prove you are a human
Verify you are human

Share

Share to Bluesky

Share to X / Twitter

Share to Facebook

Share to linkedin

Share to Pinterest

Copy Link