Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
here given code is i tried some references but cant get idea

Actually what i have to do is

invoice process to print i have to set all matter convert in PDF the that last stored PDF document get Printed in printer

here main point is just click print button just print but backgropund to store PDF as specific path and that PDF only takes as Printer

C#
string attachment = "attachment; filename=" + "abc" + ".pdf";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/pdf";
StringWriter s_tw = new StringWriter();
HtmlTextWriter h_textw = new HtmlTextWriter(s_tw);
h_textw.AddStyleAttribute("font-size", "7pt");
h_textw.AddStyleAttribute("color", "Black");
Panel2.RenderControl(h_textw);//Name of the Panel
Document doc = new Document();
doc = new Document(PageSize.A4);
//FontFactory.GetFont("Verdana", 80, iTextSharp.text.BaseColor.RED);
PdfWriter.GetInstance(doc, Response.OutputStream);
doc.Open();
StringReader s_tr = new StringReader(s_tw.ToString());
HTMLWorker html_worker = new HTMLWorker(doc);
html_worker.Parse(s_tr);
doc.Close();
Response.Write(doc);


this code refered some where

share on the suggestions
Posted
Updated 8-Oct-14 23:28pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900