Simple Conversion
Converting a file with no advanced options is straightforward. The following examples illustrate converting a file or URL to PDF followed by converting a string to PDF.
Converting a File or URL
This example demonstrates a simple file conversion from HTML (a specified URL) to PDF. The example also illustrates RTF to PDF conversion. The conversion process is similar for all 50 supported document types.
Converter.Convert("http://www.google.com", pdfFilePath);
//OR
Converter.Convert(rtfFilePath, pdfFilePath);
Converter.Convert("http://www.google.com", pdfFilePath)
'OR
Converter.Convert(rtfFilePath.rtf, pdfFilePath)
HTML String Converting
The following example demonstrates converting a specific HTML string to PDF (as opposed to using an actual HTML file or URL, as shown in the examples above). Please refer to the Converting Current Web Page to PDF section for an example of how to specify converting a current web page to PDF.
string sampleHtml = "<html><body><p>This is a very simple HTML string including a Table below.</p>" +
"<h4>Two rows and three columns:</h4><table border=\"1\"><tr><td>100</td><td>200</td>" +
"<td>300</td></tr><tr><td>400</td><td>500</td><td>600</td></tr></table></body></html>";
Converter.ConvertHtmlString(sampleHtml, pdfFilePath);
Dim sampleHtml As String = "<html><body><p>This is a very simple HTML string including a Table below.</p>" +
"<h4>Two rows and three columns:</h4><table border=""1""><tr><td>100</td><td>200</td>" +
"<td>300</td></tr><tr><td>400</td><td>500</td><td>600</td></tr></table></body></html>"
Converter.ConvertHtmlString(sampleHtml, pdfFilePath)
Specific Converter Classes
We also have ExcelConverter, HtmlConverter, ImageConverter, PowerPointConverter, RtfConverter, TextConverter, and WordConverter for converting specific file types with respective options classes.