PdfConverterGetPdfBytesFromHtmlString Method (String, String) |
Converts the specified HTML string to PDF and returns the rendered PDF document as an array of bytes.
The urlBase parameter allows the converter to determine the full URLs from relative URLs for images
and CSS files appearing in the HTML string.
Because this method does not specify the full URL of the document referenced by the internal links,
the urlBase will be used by default.
To make sure the the external resources referenced by relative URLs and the internal links with anchors
are correctly resolved by the converter, the GetPdfBytesFromHtmlString method with the
urlBase and internalLinksDocUrl additional parameters can be used.
Namespace:
ExpertPdf.HtmlToPdf
Assembly:
ephtmltopdf (in ephtmltopdf.dll) Version: 17.0.0
Syntax public byte[] GetPdfBytesFromHtmlString(
string htmlString,
string urlBase
)
Public Function GetPdfBytesFromHtmlString (
htmlString As String,
urlBase As String
) As Byte()
Parameters
- htmlString
- Type: SystemString
The HTML string to be converted to PDF. - urlBase
- Type: SystemString
The urlBase parameter allows the converter to determine the full URLs from
relative URLs for images and CSS files appearing in the HTML string.
When a relative URL from the HTML string is prefixed by the urlBase, the correct full URL of the image
or of the CSS file should be produced.
When the urlBase is not null, the converter automatically inserts a <BASE HREF="urlBase"> tag
under the HEAD tag from the HTML string.
If the HTML string does not contain a HEAD tag, the urlBase parameter does not have any effect.
Return Value
Type:
ByteAn array of bytes containing the binary representation of the PDF document.
See Also