How To Convert PDF Online?
Easy-to-use PDF software
Is there an open source to convert PDF to image in C#?
In C# you can utilize Office PDF third-party for creating PDF files in .Net. You can easily generate Pdf from Html by few lines of code. This library has very reliable and easy to use. T provide you lot of examples to merge, split documents and exports from view or db to Pdf . T provide lot of ready made examples for you so you cam easily utilize to convert html to pdf. Here is the simple example to generate PDF from HTML. using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Printing; using System.IO; using System.Text; using System.Threading.Tasks; using System.Threading; #if !WEB using System.Windows.Forms; #else using System.Web.UI; using System.Web.UI.WebControls; #endif using OfficeComponent.HtmlToPdf; namespace OfficeComponent.Samples { partial class HtmlToPdfBasicExample . ExampleBase #if WEB , IUIExample #endif { // Options public bool ConvertUrl { get; set; } public string Url { get; set; } public string HtmlString { get; set; } public string HtmlStringBaseUrl { get; set; } public int Width { get; set; } public int Height { get; set; } public OfficeComponent.HtmlToPdf.PageSize PageSize { get; set; } public bool Portrait { get; set; } public OfficeComponent.HtmlToPdf.PageMargins Margin { get; set; } public int ConversionDelay { get; set; } public int Timeout { get; set; } public bool SinglePage { get; set; } public EventHandler Progress; #if WEB public HtmlToPdfBasicExample . base(null,null) { } #endif public HtmlToPdfBasicExample(string commonDataPath, string outputDir) . base(commonDataPath, outputDir) { } public HtmlToPdfBasicExample(string commonDataPath, string outputDir, string xmlFile) . base(commonDataPath, outputDir, xmlFile) { } Action onComplete; Action onError; string outputPath; public void ExecuteAsync(Action onComplete, Action onError) { if (Width <= 0 || Height <= 0) { ShowError("Invalid Width or Height"); onComplete(null); return; } if (ConversionDelay < 0) { ShowError("Invalid conversion delay"); onComplete(null); return; } // Set output path. outputPath = Path.Combine(OutputDir, this.GetType .Name + ".pdf"); if (File.Exists(outputPath)) File.Delete(outputPath); // Create a new converter. var c = new HtmlToPdfConverter { ViewportWidth = Width, ViewportHeight = Height, PageSize = PageSize, PageMargin = Margin, Portrait = Portrait, Delay = ConversionDelay, Timeout = Timeout, SinglePage = SinglePage }; if (Progress != null) c.Progress += Progress; this.onComplete = onComplete; this.onError = onError; if (ConvertUrl) { if (string.IsNullOrWhiteSpace(Url)) { ShowError("Please specify the URL to convert."); onComplete(null); return; } // Convert URL c.ConvertAsync(Url, outputPath, OnConversionComplete); } else { if (string.IsNullOrWhiteSpace(HtmlString)) { ShowError("Please specify the HTML string to convert."); onComplete(null); return; } // Convert the specified HTML string. c.ConvertStringAsync(HtmlString, HtmlStringBaseUrl, outputPath, OnConversionComplete); } } void OnConversionComplete(object sender, AsyncCompletedEventArgs e) { if (e.Error != null) onError(e.Error); else onComplete(outputPath); } public override string Execute { if (Width <= 0 || Height < 0) { ShowError("Invalid Width or Height"); return null; } if (ConversionDelay < 0) { ShowError("Invalid conversion delay"); return null; } // Set output path. var outputPath = Path.Combine(OutputDir, this.GetType .Name + ".pdf"); if (File.Exists(outputPath)) File.Delete(outputPath); // Create a new converter. var c = new HtmlToPdfConverter { ViewportWidth = Width, ViewportHeight = Height, PageSize = PageSize, PageMargin = Margin, Portrait = Portrait, Delay = ConversionDelay, Timeout = Timeout, SinglePage = SinglePage }; if (Progress != null) c.Progress += Progress; try { if (ConvertUrl) { if (string.IsNullOrWhiteSpace(Url)) { ShowError("Please specify the URL to convert."); return null; } // Convert URL c.Convert(Url, outputPath); } else { if (string.IsNullOrWhiteSpace(HtmlString)) { ShowError("Please specify the HTML string to convert."); return null; } // Convert the specified HTML string. c.ConvertString(HtmlString, HtmlStringBaseUrl, outputPath); } } catch (Exception ex) { ShowError(ex.Message); } return outputPath; } } } I am using this library to create pdf in c#. It is very useful and easy to use. I hope it will also help you.
Convert PDF: All You Need to Know
C you. This, create you. If you(The use it can you just to:[The to.' I. :I forth most:(This set