|
HtmlToPdfConvertHtmlString Method (String, String) |
Gets a
PdfDocument object representing the result of the conversion of the specified html string to pdf.
Namespace:
SelectPdf
Assembly:
Select.Pdf (in Select.Pdf.dll) Version: 20.2
Syntax public PdfDocument ConvertHtmlString(
string htmlString,
string baseUrl
)
Public Function ConvertHtmlString (
htmlString As String,
baseUrl As String
) As PdfDocument
Parameters
- htmlString
- Type: SystemString
The html string to be converted to pdf. - baseUrl
- Type: SystemString
This parameter allows the converter to resolve relative urls. Basically, baseUrl + relative image/css url = full absolute url.
Return Value
Type:
PdfDocumentThe
PdfDocument object that can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response.
Remarks
The resulted
PdfDocument object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response.
The
PdfDocument object must be closed after save to release the system resources used during conversion.
The baseUrl parameter allows the converter to determine the full absolute urls from relative urls for images and css files appearing in the html string.
Examples
The following sample code shows how an HtmlToPdf Converter can be instantiated and a basic conversion performed.
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertHtmlString(html, baseUrl);
doc.Save(file);
doc.Close();
Dim converter as HtmlToPdf = New HtmlToPdf()
Dim doc as PdfDocument = converter.ConvertString(html, baseUrl)
doc.Save(file)
doc.Close()
See Also