简体   繁体   中英

Convert html data to pdf in devexpress using c#.net

I need to display this data to pdf please help me how to convert this html data to pdf

RichEditDocumentServer srv = new RichEditDocumentServer();
srv.LoadDocument("<html>fdhsdfd dshdsfgds</html>");       

using(Stream str= File.Create(@"D:test.pdf"))
{
     srv .ExportToPdf(str);
} 
Process.Start(@"D:test.pdf");

There are several commercial packages like AbcPdf and maybe Aspose and others.

If you are looking for a free solution, the best option might be WkHtmlToPdf , which is an EXE you call and send the URL or HTML to turn into PDF.

You don't have to write the Process.Start() code yourself though. It's kinda popular tool so there are several examples of how to use it including from C#, like: https://gist.github.com/johnnyreilly/2341776

There's also iTextSharp, but I think its CSS support is not that good.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM