Click here to Skip to main content
14,489,993 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have code like this.....
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=VisitosFoodBill_BillNo-" + Tranid + ".pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter);
print.RenderControl(htmlTextWriter);
StringReader stringReader = new StringReader(stringWriter.ToString());
Document Doc = new Document(new RectangleReadOnly(550, (i*20)+480), 10f, 10f, 10f, 10f);
HTMLWorker htmlparser = new HTMLWorker(Doc);
PdfWriter.GetInstance(Doc, Response.OutputStream);

Doc.Open();
htmlparser.Parse(stringReader);
Doc.Close();
Response.Write(Doc);
Response.End();

.............
i want to add more code to print pdf file Directly without opening print dilogbox.
how i don't know please help me that what code i write to do the process of printing pdf file..


thanks...
Posted
Updated 29-Dec-14 23:19pm
v2

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

dont know if you have to print on client.....well try this

ProcessStartInfo info = new ProcessStartInfo();
info.Verb = "print";
info.FileName = @"c:\output.pdf";
info.CreateNoWindow = true;
info.WindowStyle = ProcessWindowStyle.Hidden;

Process p = new Process();
p.StartInfo = info;
p.Start();

p.WaitForInputIdle();
System.Threading.Thread.Sleep(3000);
if (false == p.CloseMainWindow())
p.Kill();

found this on http://stackoverflow.com/questions/17448465/send-pdf-file-to-a-printer-print-pdf

hope, this helps....
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100