asp.net html to pdf,Convert Html to PDF in C#

How to Convert Html to PDF in C#.NET Code

iDiTect .NET Converter SDK is one of the best C# HTML to PDF converter libraries for .NET programming using in Winforms and ASP.NET application. Creating PDF document from html file(local or web url) easily with major features used in HTML5 and CSS/CSS3. Please note, Pseudo-classes selectors in CSS is not support now.

Converting Html to PDF with PDF or PDF/A compliance level, all html tags are support, such as images, table, links, lists, paragraphes and so on.

How to Convert Html File to PDF in C# language

Creating PDF from local html file, import html content and image/style from embedded and external folders. Or creating PDF from online page, developers need download web page content from web url, like using "WebClient", save web page to bytes or stream, and then convert them to PDF document in C#.NET.

HtmlToPdfConverter converter = new HtmlToPdfConverter();

//Load html from stream

using (Stream stream = File.OpenRead("sample.html"))

{

converter.Load(stream);

}

//Choose pdf compliance level, PDF or PDF/A

converter.PdfStandard = PdfStandard.Pdf;

//Convert html to pdf, and save it to file stream

using (var stream = File.OpenWrite("convert.pdf"))

{

converter.Save(stream);

}

How to Convert Html Elements to PDF in C# language

Creating PDF from html tags and elements. Write text content embed to html elements, such as

,

,

HtmlToPdfConverter converter = new HtmlToPdfConverter();

//Define the css for the html content

converter.DefaultStyleSheet = ".para{font-size: 24px; color: #FF0000;}";

string htmlContent = "

Content with special style.

Content without style

";

converter.Load(htmlContent);

//Choose pdf compliance level, PDF or PDF/A

converter.PdfStandard = PdfStandard.Pdf;

File.WriteAllBytes("convert.pdf", converter.SaveAsBytes());

What iDiTect .NET Document component can doWe provide powerful & profession document & image controls: Add a text watermark on PDF in C# add image & text-based watermark to documents. PDF to Image, Jpeg, multipage TIFF, PNG in C# and VB.Net PDF to Image Converter Library is a professional PDF to image converter solution for .NET, C#, VB windows and ASP.NET. How to convert .jpg file into .pdf using c# the best way to convert a GIF or JPG image to PDF in c# How to extract text from a Microsoft Word document in C# Please refer to the following section of the documentation which outlines everything you need to know about extracting Text from document. How to Convert RTF to PDF in C# effortlessly convert RTF to PDF in your application within this section, enables you to directly load file with .rtf entension and then convert RTF to PDF. Convert RTF and TXT files into DOCX files in C# Add a paragraph to the section in the Word document, declare a String variable to store the RTF string.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值