Pechkin Open Source Components use Wkhtmlbox, you can parse CSS styles, convert Web pages to PDF files,
Support URL, or HTML string
1, get Pechkin from the NuGet program Manager
globalconfig config = new GlobalConfig (); simplepechkin Pechkin = new Simplepechkin (config); objectconfig objectconfig = new Objectconfig (); objectconfig.setprintbackground (True) . Setloadimages (True) . Setaffectpagecounts (True) . Setpageuri ("http://www.abc.com/"); byte [] bytepdf = Pechkin. Convert (Objectconfig);, File.writeallbytes ("F:\\pdfname.pdf", bytePDF); 2,cpechkin, users of Pechkin are packaged, or can be obtained from NuGet
Synchronizedpechkin sc = new Synchronizedpechkin (New GlobalConfig ()
. SetMargins (New Margins () {left = 0, right = 0, Top = 0, Bottom = 0})//Set margin
. Setpaperorientation (true)); Set the paper orientation to landscape
//. Setpapersize (340, 594)); Set Paper size 50mm * 100mm
Objectconfig oc = new Objectconfig ();
Oc. Setpageuri ("http://localhost:40146/Styles/HTMLPage2.htm");
byte[] Buf = SC. Convert (OC);
Response.AddHeader ("Content-disposition", "attachment;filename=1.pdf");
Response.ContentType = "Application/octet-stream";
Response.BinaryWrite (BUF);
Using Pechkin to convert HTML pages to PDF