Print PDF from ASP.Net without preview
Posted
by nmiranda
on Stack Overflow
See other posts from Stack Overflow
or by nmiranda
Published on 2008-11-06T22:58:26Z
Indexed on
2010/06/01
22:43 UTC
Read the original article
Hit count: 201
Hi, I've generated a pdf using iTextSharp and I can preview it very well in ASP.Net but I need to send it directly to printer without a preview. I want the user to click the print button and automatically the document prints.
I know that a page can be sent directly to printer using the javascript window.print() but I don't know how to make it for a PDF.
Edit: it is not embedded, I generate it like this;
...
FileStream stream = new FileStream(Request.PhysicalApplicationPath + "~1.pdf", FileMode.Create);
Document pdf = new Document(PageSize.LETTER);
PdfWriter writer = PdfWriter.GetInstance(pdf, stream);
pdf.Open();
pdf.Add(new Paragraph(member.ToString()));
pdf.Close();
Response.Redirect("~1.pdf");
...
And here I am.
© Stack Overflow or respective owner