![]() Download the PDF document in the browser. MemoryStream stream = new MemoryStream() PdfDocument document = htmlConverter.Convert(url) Convert existing current page URL to PDF. String url = .UriHelper.GetEncodedUrl(HttpContext.Request) HtmlConverter.ConverterSettings = blinkConverterSettings Assign Blink converter settings to HTML converter. Initialize the HTML to PDF converter with the Blink rendering engine.īlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings() īlinkConverterSettings.ViewPortSize = new (1440, 0) Refer to the following code example to convert an ASP.NET Core web Razor page to PDF. With the help of our Syncfusion HTML-to-PDF converter, you can convert the ASP.NET core Razor pages to PDF with a few lines of code in C#. Converting Existing Website URL to PDFĮxperience Now Convert ASP.NET Core web Razor page to PDF PdfDocument document = htmlConverter.Convert("") īy executing this example, you will get a PDF document like in the following image. Refer to the following code example to convert an existing URL to PDF. Using this option, you can create a well-formatted PDF document from your webpage. You can easily convert a URL to a PDF with a few lines of code. ![]() Converting an HTML File to PDF Convert URL to PDF PdfDocument document = htmlConverter.Convert(Path.GetFullPath("./././input.html")) īy executing this example, you will get a PDF document like in the following image. ![]() Refer to the following code example to convert a local HTML file to PDF. You can also convert HTML files with images, CSS, forms, hyperlinks, and JavaScript to a PDF document. Create the filestream to save the PDF document.įileStream fileStream = new FileStream("HTML-to-PDF.pdf", FileMode.CreateNew, FileAccess.ReadWrite) īy executing this example, you will get a PDF document like in the following image. PdfDocument document = htmlConverter.Convert("Hello world", "") HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter() Refer to the following code to convert HTML string to PDF. This NuGet package is for Windows.įor Linux platform: .įor Mac platform:. Now, search for the package and then install it.In the Solution Explorer window, right-click on the project and select Manage NuGet Packages.You can install the HTML-to-PDF library in Visual Studio or with the command line in the NuGet package manager: Install and configure the HTML-to-PDF converter library in your project Automatically create bookmark hierarchy.Automatically create a table of contents.Convert HTML to PDF files in Cloud Platforms.Convert HTML forms to fillable PDF Forms.Convert ASP.NET Core Web Razor page to PDF.Install and configure the HTML-to-PDF converter library in your project.In this blog post, we are going to cover in detail HTML to PDF conversion in C#, provided by the Syncfusion HTML-to-PDF converter. It can be easily integrated into any application with five simple lines of code. It uses the Chromium Blink engine to convert HTML pages to PDF documents. The HTML-to-PDF converter preserves all graphics, text, fonts, links, and the layout of the original HTML document or webpage. Your PDF will look exactly like the webpage you have converted. Using the Syncfusion HTML-to-PDF converter library, you can convert an entire webpage into a PDF file, or just convert a portion of the page with C#. ![]() In that case, you need a versatile converter to convert the exact content of HTML to PDF. While going through a webpage, you may want to download the HTML content as a PDF file for further reference. BoldSign – Electronic Signature Software.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |