HTML2PDF Module is an optional add-on utility which can be used with Apryse SDK to convert an HTML file to a PDF document without any external third party dependencies. Samples offered in Python, Java, C#, JavaScript, PHP, Ruby, C++, Objective C, Go, VB; for Mac, Linux and Windows.
1// Start with a PDFDoc (the conversion destination)
2$doc = new PDFDoc();
3$converter = new HTML2PDF();
4
5// add from HTML String data
6converter->InsertFromHtmlString($htmlString);
7
8// add from a web page location
9converter->InsertFromURL($webPageLocation);
10
11// apply conversion
12converter->Convert($doc);
1# Start with a PDFDoc (the conversion destination)
2doc = PDFDoc()
3converter = HTML2PDF()
4
5# add from HTML String data
6converter.InsertFromHtmlString(htmlString)
7
8# add from a web page location
9converter.InsertFromURL(webPageLocation)
10
11# apply conversion
12converter.Convert(doc)
1# Start with a PDFDoc (the conversion destination)
2doc = PDFDoc.new()
3converter = HTML2PDF.new()
4
5# add from HTML String data
6converter.InsertFromHtmlString(htmlString)
7
8# add from a web page location
9converter.InsertFromURL(webPageLocation)
10
11# apply conversion
12converter.Convert(doc)
1' Start with a PDFDoc (the conversion destination)
2Dim doc As PDFDoc = New PDFDoc()
3Dim converter As HTML2PDF = New HTML2PDF()
4
5' add from HTML String data
6converter.InsertFromHtmlString(htmlString)
7
8' add from a web page location
9converter.InsertFromURL(webPageLocation)
10
11' apply conversion
12converter.Convert(doc)
Convert HTML to PDF - Full Sample Code Full sample code for directly converting HTML pages to PDF by using 'pdftron.PDF.HTML2PDF'. The HTML2PDF converter supports HTML conversion from a string or URL and offers many options to control page size and formatting. Samples available in Python, C# (.Net), C++, Go, Java, Node.js (JavaScript), PHP, Ruby, VB.