How to export a Diagram to a PdfDocument server side
The Syncfusion Essential HTML converter supports HTML to PDF conversion by using the advanced Blink rendering engine. This converter can be easily integrated into any application on .NET platforms and export HTML to PDF.
We can export the diagram to pdf using blink render engine by getting the URL of the page and convert it into pdf. We have prepared a working sample of “How to export a Diagram to Pdf using Blink engine” and download link provided in the bottom of the document. In this sample, we have provided a button to export the diagram to pdf. For more info, please refer to the following code snippet and the documentation links below.
The following code shows how to export URL to pdf.
protected void Button1_Click(object sender, EventArgs e)
{
//Initialize the HTML to PDF converter with Blink rendering engine
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink);
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
blinkConverterSettings.Orientation = PdfPageOrientation.Portrait;
//Set the BlinkBinaries folder path
blinkConverterSettings.BlinkPath = Server.MapPath("~/BlinkBinaries");
//Assign Blink converter settings to HTML converter
htmlConverter.ConverterSettings = blinkConverterSettings;
//Get the current URL
string url = HttpContext.Current.Request.Url.AbsoluteUri;
//Convert URL to PDF
PdfDocument document = htmlConverter.ConvertPartialHtml(url, "Calendar1");
//Save the document
document.Save("Sample.pdf", HttpContext.Current.Response, HttpReadType.Save);
}
Documentation link: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink
Documentation link for prerequisites: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#prerequisites-for-windows
Sample Link:https://www.syncfusion.com/downloads/support/directtrac/general/ze/HtmlToPDF_WebForms1247561045
Note:
A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.
The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.
You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!