Click here to Skip to main content
15,890,845 members
Home / Discussions / C#
   

C#

 
GeneralRe: Unlimited List Pin
#realJSOP9-Jul-08 23:19
mve#realJSOP9-Jul-08 23:19 
QuestionTrying to Print a file from C# code...NEWBIE Pin
zachbob9-Jul-08 7:35
zachbob9-Jul-08 7:35 
AnswerRe: Trying to Print a file from C# code...NEWBIE Pin
Christian Graus9-Jul-08 7:40
protectorChristian Graus9-Jul-08 7:40 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
zachbob9-Jul-08 7:42
zachbob9-Jul-08 7:42 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
Luc Pattyn9-Jul-08 8:00
sitebuilderLuc Pattyn9-Jul-08 8:00 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
zachbob9-Jul-08 8:46
zachbob9-Jul-08 8:46 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
Luc Pattyn9-Jul-08 9:17
sitebuilderLuc Pattyn9-Jul-08 9:17 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
zachbob9-Jul-08 9:36
zachbob9-Jul-08 9:36 
It is actually a web application.

Server.Map - Returns the physical file path that corresponds to the specified virtual path on the Web server.

The pdf opens just fine outside of the web app.

here is some more code to help out:
I start by combining some PDFs into one pdf, then I show it in a pane, then I want the print dialog box to show right after it loads in the pane...

tmpPdf = "/temp/" + Session.SessionID + ".pdf";
PrepareCombinedFile();
FileStream fs = new FileStream(Server.MapPath(tmpPdf), FileMode.Open);
byte[] pdf = new byte[fs.Length];
fs.Read(pdf, 0, Convert.ToInt32(fs.Length));
			
Response.Clear();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Length",pdf.Length.ToString());
Response.BinaryWrite( pdf );
Response.Flush();
Response.Close();
fs.Close();
try
{
        Process printPDF = new Process();
        ProcessStartInfo psi = new ProcessStartInfo();
	psi.Verb = "Print";
	psi.FileName = Server.MapPath(tmpPdf); 
	psi.CreateNoWindow = true;
	printPDF.StartInfo = psi;
	printPDF.Start();
					
				
}
catch(Exception ex)
{
throw new Exception(ex.Message, ex.InnerException);
}

GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
Luc Pattyn9-Jul-08 9:50
sitebuilderLuc Pattyn9-Jul-08 9:50 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
zachbob10-Jul-08 3:06
zachbob10-Jul-08 3:06 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
Luc Pattyn10-Jul-08 3:19
sitebuilderLuc Pattyn10-Jul-08 3:19 
GeneralRe: Trying to Print a file from C# code...NEWBIE Pin
Luc Pattyn14-Jul-08 0:53
sitebuilderLuc Pattyn14-Jul-08 0:53 
QuestionFinding COM-port information Pin
Tummelisa9-Jul-08 7:27
Tummelisa9-Jul-08 7:27 
Questionopening a from with reflection Pin
belzer9-Jul-08 6:09
belzer9-Jul-08 6:09 
AnswerRe: opening a from with reflection Pin
Christian Graus9-Jul-08 6:41
protectorChristian Graus9-Jul-08 6:41 
GeneralRe: opening a from with reflection Pin
belzer9-Jul-08 6:51
belzer9-Jul-08 6:51 
GeneralRe: opening a from with reflection Pin
led mike9-Jul-08 7:08
led mike9-Jul-08 7:08 
GeneralRe: opening a from with reflection Pin
Christian Graus9-Jul-08 7:19
protectorChristian Graus9-Jul-08 7:19 
GeneralRe: opening a from with reflection Pin
belzer9-Jul-08 7:29
belzer9-Jul-08 7:29 
QuestionReading an XLS sheet without ODBC? Pin
Xpnctoc9-Jul-08 5:59
Xpnctoc9-Jul-08 5:59 
AnswerRe: Reading an XLS sheet without ODBC? Pin
Russell Jones9-Jul-08 6:28
Russell Jones9-Jul-08 6:28 
GeneralRe: Reading an XLS sheet without ODBC? Pin
Xpnctoc9-Jul-08 6:34
Xpnctoc9-Jul-08 6:34 
GeneralRe: Reading an XLS sheet without ODBC? Pin
Russell Jones9-Jul-08 6:38
Russell Jones9-Jul-08 6:38 
QuestionArrow in rowheader Pin
anton-099-Jul-08 5:39
anton-099-Jul-08 5:39 
AnswerRe: Arrow in rowheader Pin
paas9-Jul-08 6:42
paas9-Jul-08 6:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.