asp.net - How to implement "--print-media-type" with c#? -


i using wkhtmltopdf c# download webpage pdf format. however, want generated pdf shown using "print.css".

additional details: using microsoft visual studio 2010.

this code:

protected void imagebutton2_click(object sender, imageclickeventargs e) {     string args = string.format("\"{0}\" - ", request.url.absoluteuri);     var startinfo = new processstartinfo(server.mappath("~/wkhtmltopdf/") + "wkhtmltopdf.exe", args)     {         useshellexecute = false,         redirectstandardoutput = true     };      var proc = new process { startinfo = startinfo };     proc.start();      response.addheader("content-disposition", string.format("attachment;filename=staffdetails.pdf", guid.newguid()));     response.addheader("content-type", "application/pdf"); string output = proc.standardoutput.readtoend();     byte[] buffer = proc.standardoutput.currentencoding.getbytes(output);     proc.close();     response.binarywrite(buffer);     } } 

simply add argument. try like

string args = string.format("--print-media-type \"{0}\" - ", request.url.absoluteuri); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -