Get familiar with converting HTML to PDF in a VB.NET project with a few lines of code
It is not always easy to convert web pages or HTML files to PDF, especially when the quality of conversion and customization are important. An appropriate HTML to PDF .NET converter needs an SDK and library support. It is had to find a library or an API, which has good error handling, is customizable and scalable.
BCL easyPDF SDK is the best solution to create PDF files from HTML in a .NET environment. You will appreciate the simplicity, speed, and the quality of conversion. As a first step towards building an HTML to PDF application in .NET, install our easyPDF SDK. With a few lines of Visual Basic, developers can begin creating power HTML to PDF .NET converters.
Printer printer = new Printer();
PrintJob printjob = printer.PrintJob;
This SDK provides users with excellent quality of HTML to PDF conversion in VB.NET and we support a wide range of other programming languages.
|HTML – input file (bcltechnologies.com/financial/data-mining.htm)
||PDF created from HTML .NET by easyPDF SDK Action Center
In a matter of minutes, you can convert any webpage (URL) or HTML file to a PDF document in .NET environment. The SDK also supports various settings, like additional security, margins, watermarks, font replacement, hyperlink preservation, page format settings and smart shrinking.
How to build HTML to PDF .NET application with multiple settings
To code your own HTML to PDF .NET converter with features such as margin settings, font replacements, page width, hyperlinks preservation and making it grayscale:
- Download and install free easyPDF SDK trial which comes with many useful PDF APIs for programming in .NET;
- Copy and paste the following lines of code to your application:
Dim inputFileName As String = Args(0)
Dim outputFileName As String = Args(1)
Dim printer As New Printer()
Dim printjob As IEPrintJob = printer.IEPrintJob
Dim printerSettings As PrinterSetting = printer.PrinterSetting
printerSettings.LayoutPaperSize = CInt(prnPaperSize.PRN_PAPER_A4)
printerSettings.LayoutPaperOrientation = prnPaperOrientation.PRN_PAPER_ORIENT_PORTRAIT
printerSettings.LayoutGraphicResolution = 300
printerSettings.LayoutScaling = 100
printerSettings.LayoutPrintColorType = prnPrintColorType.PRN_PRINT_COLOR_GRAYSCALE
Dim pdfSettings As PDFSetting = printjob.PDFSetting
pdfSettings.FontEmbedding = prnFontEmbedding.PRN_FONT_EMBED_SUBSET
pdfSettings.FontEmbedAsType0 = True
Dim ieSettings As IESetting = printjob.IESetting
ieSettings.Header = "&w&bPage &p of &P"
ieSettings.Footer = "&u&b&d"
ieSettings.MarginLeft = 0.0138888888888889
ieSettings.MarginRight = 0.0138888888888889
ieSettings.MarginTop = 0.0138888888888889
ieSettings.MarginBottom = 0.0138888888888889
ieSettings.PrintBGColor = True
ieSettings.ShrinkToFit = True
ieSettings.DisableScriptDebugger = False
ieSettings.DisplayErrorDialogOnEveryError = False
The following code will add metadata settings to your HTML to PDF .NET converter:
pdfSettings.MetaData = True
pdfSettings.MetaDataTitle = "title"
pdfSettings.MetaDataAuthor = "author"
pdfSettings.MetaDataSubject = "subject"
pdfSettings.MetaDataKeywords = "keyword"
pdfSettings.MetaDataCreator = "creator"
Powerful error handling mechanism could be added to your HTML to PDF .NET application with the following code:
Catch ex As PrinterException
|HTML – input file (bclresearch.com/Home)
||PDF created from HTML .NET with the code
Build professional HTML to PDF .NET applications with no coding
BCL easyPDF SDK provides a unique combination of properties and features with a user-friendly visual interface. This allows developers to build powerful conversion applications in .NET without any coding. Developing such an application has never been easier, now anyone can create enterprise-level HTML to PDF .NET converter applications with customized settings. Simply select the settings, generate an executable file, or generate the code with the press of a button.
Useful PDF Features for HTML to PDF .NET Programming
Our SDK offers a high-level .NET API for converting a variety of file formats to PDF, modifying existing PDF files, converting PDF documents to multiple image formats, and also populating PDF form fields. Our commercially supported toolkit is extremely easy to use in any .NET application working with PDF files.
BCL easyPDF SDK comes with robust error handling to help you merge, modify and convert HTML to PDF and many other formats. Threads are monitored for time-outs to make sure that they do not stop an application’s operation. Each thread in BCL easyPDF SDK is isolated from other threads and does not affect their operation.
Different PrintJob types are optimized for best rendering result for HTML to PDF conversion. PDF looks the same as the page in a web browser. HTML to PDF API supports PDF/A & PDF/X standards for long term archiving of electronic documents or exchange of print-ready PDF files in printing/advertising industries. It can automatically handle any exception or error message that may occur in converting HTML and Office documents to PDF.
SDK's speed and reliability are tested in our free PDF conversion service which processes thousands of PDF conversions per day and runs 24/7 with no human operator.
Many enterprise software developers in the world currently use and leverage the multitude of features supported by easyPDF SDK such as Image compression, Metadata, Font Embedding & Subsetting, Digital Signature & Stamping, Watermark, PDF Security, PDF Viewer setting.
Join them now by downloading HTML to PDF .NET free SDK trial!
HTML to PDF .NET SDK references
easyPDF SDK includes the following Libraries and APIs with imaginary features:
- PDF Printer API supports converting multiple format documents to PDF;
- PDF Processor API does Merging, Splitting, Rotating, Deleting, Extracting and Optimizing of PDF files;
- PDF Converter API responds for Rasterizing PDF into BMP, GIF, JPEG, PNG, and TIFF image formats;
- PDF Document API extracts, inserts, and updates data in PDF Forms with.
easyPDF SDK team provides professional support and assistance in the SDK integration with your desktop or server .NET application. Try it now!
Frequently Asked Questions
Why software developers from different countries and industries like our HTML to PDF .NET converter?