Getting Started with EVO HTML to PDF Converter

2
ASP.NET Demo Application Getting Started with EVO HTML to PDF Converter for .NET Select to convert an URL or a HTML code, then select to convert to PDF or to an image and press the Convert button. When converting a HTML string the Base URL parameter helps the converter to determine the full URL of the CSS and images referenced by relative URLs in the HTML string. Getting Started HTML to PDF Features Demo Dinamically Create PDF Invoices Convert Multiple URLs to PDF HTML in Header and Footer HTML Elements Location in PDF Repeat HTML Table Head in PDF Table of Contents and Bookmarks PDF Security and Permissions Append External PDF Documents Html to PDF Elements Demo Text and True Type Fonts Demo Image Elements Demo PDF Graphics Shapes Demo PDF Stamps and Watermarks Demo SVG to PDF Conversion Demo Select HTML source: Convert HTML from URL Convert HTML String Enter URL: http://www.evopdf.com Convert to PDF Convert to image Fit Width Live Links Embed Fonts Bookmarks JavaScript JPEG Compression Add Header Add Footer PDF Open Mode: Attachment Inline Convert C# Code Sample / / / < s u m m a r y > / / / C o n v e r t t h e H T M L c o d e f r o m t h e s p e c i f i e d U R L t o a P D F d o c u m e n t a n d s e n d t h e d o c u m e n t t o t h e b r o w s e r / / / < / s u m m a r y > p r i v a t e v o i d C o n v e r t U R L T o P D F ( ) { s t r i n g u r l T o C o n v e r t = t e x t B o x W e b P a g e U R L . T e x t . T r i m ( ) ; / / C r e a t e t h e P D F c o n v e r t e r . O p t i o n a l l y t h e H T M L v i e w e r w i d t h c a n b e s p e c i f i e d a s p a r a m e t e r / / T h e d e f a u l t H T M L v i e w e r w i d t h i s 1 0 2 4 p i x e l s . P d f C o n v e r t e r p d f C o n v e r t e r = n e w P d f C o n v e r t e r ( ) ; / / s e t t h e l i c e n s e k e y - r e q u i r e d p d f C o n v e r t e r . L i c e n s e K e y = " O R I J G Q o K G Q k Z C x c J G Q o I F w g L F w A A A A A = " ; / / s e t t h e c o n v e r t e r o p t i o n s - o p t i o n a l p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . P d f P a g e S i z e = P d f P a g e S i z e . A 4 ; p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . P d f C o m p r e s s i o n L e v e l = P d f C o m p r e s s i o n L e v e p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . P d f P a g e O r i e n t a t i o n = P d f P a g e O r i e n t a t i o n . / / s e t i f h e a d e r a n d f o o t e r a r e s h o w n i n t h e P D F - o p t i o n a l - d e f a u l t i s f a l s e p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . S h o w H e a d e r = c b A d d H e a d e r . C h e c k e d ; p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . S h o w F o o t e r = c b A d d F o o t e r . C h e c k e d ; / / s e t i f t h e H T M L c o n t e n t i s r e s i z e d i f n e c e s s a r y t o f i t t h e P D F p a g e w i d t h - d e f a u l t i s t r u e p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . F i t W i d t h = c b F i t W i d t h . C h e c k e d ; / / s e t t h e e m b e d d e d f o n t s o p t i o n - o p t i o n a l - d e f a u l t i s f a l s e p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . E m b e d F o n t s = c b E m b e d F o n t s . C h e c k e d ; / / s e t t h e l i v e H T T P l i n k s o p t i o n - o p t i o n a l - d e f a u l t i s t r u e p d f C o n v e r t e r . P d f D o c u m e n t O p t i o n s . L i v e U r l s E n a b l e d = c b L i v e L i n k s . C h e c k e d ; / / s e t i f t h e J a v a S c r i p t i s e n a b l e d d u r i n g c o n v e r s i o n t o a P D F - d e f a u l t i s t r u e p d f C o n v e r t e r . J a v a S c r i p t E n a b l e d = c b C l i e n t S c r i p t s . C h e c k e d ; / / s e t i f t h e i m a g e s i n P D F a r e c o m p r e s s e d w i t h J P E G t o r e d u c e t h e HTML in Header and Footer Demo This is page 1 of 2 Demo Version - Evo Pdf Tools

description

Select to convert an URL or a HTML code, then select to convert to PDF or to an image and press the Convert button

Transcript of Getting Started with EVO HTML to PDF Converter

Page 1: Getting Started with EVO HTML to PDF Converter

ASP.NET Demo Application

Getting Started with EVO HTML to PDF Converter for .NET

Select to convert an URL or a HTML code, then select to convert to PDF or to an image and press the Convert button. When converting a HTML string theBase URL parameter helps the converter to determine the full URL of the CSS and images referenced by relative URLs in the HTML string.

Getting Started

HTML to PDF Features Demo

Dinamically Create PDF Invoices

Convert Multiple URLs to PDF

HTML in Header and Footer

HTML Elements Location in PDF

Repeat HTML Table Head in PDF

Table of Contents and Bookmarks

PDF Security and Permissions

Append External PDF Documents

Html to PDF Elements Demo

Text and True Type Fonts Demo

Image Elements Demo

PDF Graphics Shapes Demo

PDF Stamps and Watermarks Demo

SVG to PDF Conversion Demo

Select HTML source:

Convert HTML from URL Convert HTML String

Enter URL: http://www.evopdf.com

Convert to PDF

Convert to image

Fit Width Live Links Embed Fonts

Bookmarks JavaScript JPEG Compression

Add Header Add Footer

PDF Open Mode: Attachment Inline

Convert

C# Code Sample

/// <summary> /// Convert the HTML code from the specified URL to a PDF document and send the document to the browser /// </summary> private void ConvertURLToPDF() { string urlToConvert = textBoxWebPageURL.Text.Trim();

// Create the PDF converter. Optionally the HTML viewer width can be specified as parameter // The default HTML viewer width is 1024 pixels. PdfConverter pdfConverter = new PdfConverter();

// set the license key - required pdfConverter.LicenseKey = "ORIJGQoKGQkZCxcJGQoIFwgLFwAAAAA=";

// set the converter options - optional pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4; pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal; pdfConverter.PdfDocumentOptions.PdfPageOrientation = PdfPageOrientation.Portrait;

// set if header and footer are shown in the PDF - optional - default is false pdfConverter.PdfDocumentOptions.ShowHeader = cbAddHeader.Checked; pdfConverter.PdfDocumentOptions.ShowFooter = cbAddFooter.Checked; // set if the HTML content is resized if necessary to fit the PDF page width - default is true pdfConverter.PdfDocumentOptions.FitWidth = cbFitWidth.Checked;

// set the embedded fonts option - optional - default is false pdfConverter.PdfDocumentOptions.EmbedFonts = cbEmbedFonts.Checked; // set the live HTTP links option - optional - default is true pdfConverter.PdfDocumentOptions.LiveUrlsEnabled = cbLiveLinks.Checked;

// set if the JavaScript is enabled during conversion to a PDF - default is true pdfConverter.JavaScriptEnabled = cbClientScripts.Checked;

// set if the images in PDF are compressed with JPEG to reduce the

HTML in Header and Footer Demo

This is page 1 of 2  

Demo Version - Evo Pdf Tools

Page 2: Getting Started with EVO HTML to PDF Converter

PDF document size - default is true pdfConverter.PdfDocumentOptions.JpegCompressionEnabled = cbJpegCompression.Checked;

// enable auto-generated bookmarks for a specified list of HTML selectors (e.g. H1 and H2) if (cbBookmarks.Checked) { pdfConverter.PdfBookmarkOptions.HtmlElementSelectors = new string[] { "H1", "H2" }; }

// add HTML header if (cbAddHeader.Checked) AddHeader(pdfConverter); // add HTML footer if (cbAddFooter.Checked) AddFooter(pdfConverter);

// Performs the conversion and get the pdf document bytes that can // be saved to a file or sent as a browser response byte[] pdfBytes = pdfConverter.GetPdfBytesFromUrl(urlToConvert);

// send the PDF document as a response to the browser for download System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Type", "application/pdf"); if (radioAttachment.Checked) response.AddHeader("Content-Disposition", String.Format("attachment; filename=GettingStarted.pdf; size={0}", pdfBytes.Length.ToString())); else response.AddHeader("Content-Disposition", String.Format("inline; filename=GettingStarted.pdf; size={0}", pdfBytes.Length.ToString())); response.BinaryWrite(pdfBytes); // Note: it is important to end the response, otherwise the ASP.NET // web page will render its content to PDF document stream response.End(); }

HTML in Header and Footer Demo

This is page 2 of 2  

Demo Version - Evo Pdf Tools