|
|
|
|
|
EVO HTML to PDF Converter
|
for Azure
|
|
|
|
EVO HTML to PDF Converter Library for .NET and .NET Core can be used directly in web roles and worker roles of
Azure Cloud Services and in applications running on Azure Virtual Machines but it cannot be used
in Azure Websites directly because of the restrictions imposed by Azure App Service environment.
For Azure App Service Websites we developed a solution consisting in a service that you can deploy
in Azure Cloud and a client library that you can link directly into your Azure App Service Website to call
that service completely transparent for you. The API of the client library is almost identical to the regular
.NET library API.
The converter offers full support for HTML5, CSS3, JavaScript, SVG, web fonts,
page breaks control with CSS and from API, automatically repeated HTML table header and footer,
live URLs and internal links, automatically generated hierarchical bookmarks and table of contents,
automatically generated fillable PDF forms and allows you to digitally sign and password protect
the generated PDF documents.
The demo website for Azure offers sample code for the most important features of the client library. The same demo website with
complete C# source code can also be found in the product package you can download from our website.
|
|
|
|
|
|
|
 |
|
Software Download |
|
|
EVO HTML to PDF Converter for Azure is distributed in a Zip archive. You can follow the link below to download the software.
The Zip archive contains the .NET and .NET Core client library for Azure websites, the API documentation in CHM format and a
demo Azure website to convert HTML to PDF. The EVO PDF Server is a separate download.
|
|
|
|
|
|
The HTML to PDF converter client library for Azure is also available as a
NuGet package that can referenced directly from your Visual Studio project.
|
|
 |
|
Software Installation |
|
|
In order to use the EVO HTML to PDF Converter for Azure you first have to publish the HTML to PDF Server in Azure Cloud.
The client library for .NET and .NET Core that you reference in your application will know how to connect to the HTML to PDF Server
to convert HTML to PDF, to Image or to SVG. You can find detailed installation and uninstallation instructions in
the Readme.txt file from the root of the downloaded package.
|
|
 |
|
Azure Code Sample |
|
|
The EVO HTML to PDF Converter for Azure API allows you to convert a HTML document to PDF in just a few lines a code. The programming interface is
also very rich and allows you customize the generated PDF document in various ways. The code below is copied from the demo for
HTML to PDF Converter that you can find the in the Demo folder of the software Zip package.
|
protected void convertToPdfButton_Click(object sender, EventArgs e)
{
// Get the server IP and port
String serverIP = textBoxServerIP.Text;
uint serverPort = uint.Parse(textBoxServerPort.Text);
// Create a HTML to PDF converter object with default settings
HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter(serverIP, serverPort);
// Set optional service password
if (textBoxServicePassword.Text.Length > 0)
htmlToPdfConverter.ServicePassword = textBoxServicePassword.Text;
// Set license key received after purchase to use the converter in licensed mode
// Leave it not set to use the converter in demo mode
htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c=";
// Set HTML Viewer width in pixels which is the equivalent in converter of the browser window width
htmlToPdfConverter.HtmlViewerWidth = int.Parse(htmlViewerWidthTextBox.Text);
// Set HTML viewer height in pixels to convert the top part of a HTML page
// Leave it not set to convert the entire HTML
if (htmlViewerHeightTextBox.Text.Length > 0)
htmlToPdfConverter.HtmlViewerHeight = int.Parse(htmlViewerHeightTextBox.Text);
// Set PDF page size which can be a predefined size like A4 or a custom size in points
// Leave it not set to have a default A4 PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageSize = SelectedPdfPageSize();
// Set PDF page orientation to Portrait or Landscape
// Leave it not set to have a default Portrait orientation for PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageOrientation = SelectedPdfPageOrientation();
// Set the maximum time in seconds to wait for HTML page to be loaded
// Leave it not set for a default 60 seconds maximum wait time
htmlToPdfConverter.NavigationTimeout = int.Parse(navigationTimeoutTextBox.Text);
// Set an adddional delay in seconds to wait for JavaScript or AJAX calls after page load completed
// Set this property to 0 if you don't need to wait for such asynchcronous operations to finish
if (conversionDelayTextBox.Text.Length > 0)
htmlToPdfConverter.ConversionDelay = int.Parse(conversionDelayTextBox.Text);
// The buffer to receive the generated PDF document
byte[] outPdfBuffer = null;
if (convertUrlRadioButton.Checked)
{
string url = urlTextBox.Text;
// Convert the HTML page given by an URL to a PDF document in a memory buffer
outPdfBuffer = htmlToPdfConverter.ConvertUrl(url);
}
else
{
string htmlString = htmlStringTextBox.Text;
string baseUrl = baseUrlTextBox.Text;
// Convert a HTML string with a base URL to a PDF document in a memory buffer
outPdfBuffer = htmlToPdfConverter.ConvertHtml(htmlString, baseUrl);
}
// Send the PDF as response to browser
// Set response content type
Response.AddHeader("Content-Type", "application/pdf");
// Instruct the browser to open the PDF file as an attachment or inline
Response.AddHeader("Content-Disposition", String.Format("{0}; filename=Getting_Started.pdf; size={1}",
openInlineCheckBox.Checked ? "inline" : "attachment", outPdfBuffer.Length.ToString()));
// Write the PDF document buffer to HTTP response
Response.BinaryWrite(outPdfBuffer);
// End the HTTP response and stop the current page processing
Response.End();
}
|
|