Question:I want to generate PDF by passing HTML contents to a function. I have made use of ItextSharp for this but it does not perform well when it encounters Table and the layout just gets messy.Is there any software available on VeryPDF?
Answer: According to your needs that you need to convert HTML to PDF with original layout and formats. Meanwhile you need to use someone which could be called from VB.NET. If I understand you in a ringt way, maybe you can have a free trial of this software: VeryPDF Web page to PDF Converter Cloud API, by which API, you can convert web pages to PDF files. And this software fully supports HTML and CSS tags, including page breaks, JavaScript and other html elements.By this API, you can also set options for output PDF file. Most important, this cloud API could be used together with C#, VB.NET, ASP.NET, ASP, PHP, Java, Ruby, Amazon, etc. Please check more related information of this software on homepage, in the following part, let us check how to use this software.
Step 1 . Register for an API key
- This is software is not freeware but it is quite cheap as it charges per Month. Say if your projects will last one month, you can simply buy one month of this software. It only charges $19.95 / Month. By this method, you do not need to buy some expensive SDK software for whole life using.
- Before using this software, please register an account then an API code will be sent to your email box at once.
Step 2. Convert HTML to PDF by Web page to PDF Converter Cloud API
- When converting HTML to PDF, please use this online link.
http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2pdf&infile=https://www.verypdf.com&outfile=verypdf.pdf
Please pay more attention to the structure of this link. First, please add API code= at this part, then specify which software you use like html2pdf, at last please specify the website link you need to convert and output PDF file. - By this software, you can specify many options like specify output PDF paper size, output grayscale PDF file or insert header or footer to output PDF.
- Now let us check more examples of editing this link for different output.
Convert web page to PDF file with A3 paper,
http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2pdf&infile=http://www.verydoc.com&outfile=verydoc.pdf&--page-size=A3
Convert web page to PDF file and insert header and footer text contents,
http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2pdf&infile=https://www.verypdf.com&outfile=verypdf.pdf&--header-left=https://www.verypdf.com&--header-right=Page%20[page]/[toPage]&--margin-top=2cm&--header-line&--footer-left=Date:%20[date]%20%20%20%20Time:%20[time]
Now let us check how to call this software from VB.NET to convert HTML to PDF.
Imports System.IO Imports System.Net Module Module1 Sub Main() 'Address of URL Dim URL As String = "http://online.verypdf.com/api/?apikey=XXXX-XXXX-XXXX-XXXX&app=html2image&infile=https://www.verypdf.com&outfile=verypdf.jpg" ' Get HTML data Dim client As WebClient = New WebClient() Dim data As Stream = client.OpenRead(URL) Dim reader As StreamReader = New StreamReader(data) Dim str As String = "" str = reader.ReadLine() Do While str <> Nothing Console.WriteLine(str) str = reader.ReadLine() Loop End Sub End Module
During the using, if you have any question, please contact us as soon as possible.