Send document to printer from web page

Posted by FiveTools on Stack Overflow See other posts from Stack Overflow or by FiveTools
Published on 2010-03-25T18:53:41Z Indexed on 2010/03/25 19:03 UTC
Read the original article Hit count: 333

Filed under:
|
|

I have a webpage that activates a print job on a printer. This works in the localhost environment but does not work when the application is deployed to the webserver. I'm using the PrintDocument class from the .net System.Drawing.Print namespace. I'm now assuming the printer has to be available to the application on the remote server? Any suggestions on how I would get this to work?

PrintDocument pd = new PrintDocument();
PaperSource ps = new PaperSource();
pd.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Custom", 1180, 850);
pd.PrintPage += new PrintPageEventHandler
                    (this.pd_PrintPage);

// Set your printer's name.  Obtain from
// System's Printer Dialog Box. 
pd.PrinterSettings.PrinterName =
    "Okidata ML 321 Turbo/D (IBM)";


//PrintPreviewDialog dlgPrintPvw = new PrintPreviewDialog();
//dlgPrintPvw.Document = pd;
//dlgPrintPvw.Focus();
//dlgPrintPvw.ShowDialog(); 

pd.Print();

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET