Click or drag to resize

PdfConverter Class

This class is the main class of the HTML to PDF Converter which offers the necessary methods to create a PDF document from a web page or from a HTML string. The generated PDF document can be saved in memory or in a file.
Inheritance Hierarchy
SystemObject
  ExpertPdf.Anywhere.HtmlToPdfPdfConverter

Namespace: ExpertPdf.Anywhere.HtmlToPdf
Assembly: ExpertPdf.Anywhere (in ExpertPdf.Anywhere.dll) Version: 22.0
Syntax
public class PdfConverter

The PdfConverter type exposes the following members.

Constructors
 NameDescription
Public methodPdfConverter Creates a HTML to PDF converter which will use the default width of 1024 pixels to layout the HTML document. The height of the HTML document will be automatically calculated based on the default width. Because the default width of 1024 pixels might not be enough to display entirely the HTML document or because the HTML content might be scaled down to fit the PDF document page width, the other constructors allow to specify a custom width in pixels for the HTML document.
Public methodPdfConverter(Int32) Creates a HTML to PDF converter which will automatically calculate the height of the HTML document based on the specified width. The width in pixels of the HTML document is specified by the htmlDocWidthPx parameter. If this parameter is set to 0 or a negative value, the width of the HTML document will be automatically calculated. Because all the dimensions in the PDF document are measured in points (1 point is 1/72 inch), it might be necessary pixels to transform pixels to points and points to pixels using the UnitsConverter class in order to better control the HTML to PDF conversion.
Public methodPdfConverter(Int32, Int32) Creates a HTML to PDF converter using the specified width and height in pixels for the HTML document. The width in pixels of the HTML document is specified by the htmlDocWidthPx parameter. If this parameter is set to 0 or a to negative value, the width of the HTML document will be automatically calculated. The height in pixels of the HTML document is specified by the htmlDocHeightPx parameter. The HTML document will be truncated if its height exceeds the htmlDocHeightPx value. If this parameter is set to 0 or a negative value, the whole HTML document will be converted to PDF. Because all the dimensions in the PDF document are measured in points (1 point is 1/72 inch), it might be necessary to transform pixels to points and points to pixels using the UnitsConverter class in order to better control the HTML to PDF conversion.
Top
Properties
 NameDescription
Public propertyAccessibilityStandard Gets or sets the accessibility standard the generated document declares.
Public propertyAllowContentHeightResize A flag indicating if the content height can be recalculated to better fit the page. This can introduce certain errors in some cases.
Public propertyAllowLocalAccess A flag indicating if local files can be loaded during the conversion. The default value is True and local files can be loaded.
Public propertyAuthenticationOptions Optionally set this object Username and Password properties to authenticate to the web server with HTTP authentication before accessing the URL to be converted.
Public propertyCefEnginePath Gets or sets the full path of the folder containing the Chromium rendering engine.
Public propertyCefEngineTemporaryFilesPath Gets or sets the full path of a folder where the Chromium rendering engine will write temporary files.
Public propertyClickElementsDelayAfter Delay in miliseconds, after element click.
Public propertyClickElementsDelayBefore Delay in miliseconds, before element click.
Public propertyClickElementsSelectors Specifies elements from the web page that will be clicked before converting the page.
Public propertyClipHtmlView If the HTML content is not entirely visible in the HTML viewer at the specified width, the ClipHtmlView property will control whether the HTML content is clipped or the HTML viewer width is automatically extended to make visible the whole HTML content. The HTML viewer width is given by the PageWidth property. The default value of this property is false. The width is handled the same way whether this is set or not; when this property is true and a height is set with the PageHeight property, the HTML viewer is rendered at that fixed height and the content below it is left out of the generated PDF. With a height of 0 this property has no effect.
Public propertyColorSpace Gets or sets the color space of the generated PDF document. The possible values are RGB, CMYK or Gray Scale. The default color space is RGB.
Public propertyConversionDelay An additional time in seconds to wait for asynchronous items to be loaded. Use it for content that appears after the page has loaded, for example charts drawn or data loaded by scripts.
Public propertyConversionSummary Offers summary information about the conversion process. After a successfull conversion this property is initialized with an instance of the ConversionSummary class. If the conversion failed this property returns a null value.
Public propertyCreateFormFields Converts the controls of the HTML forms into fillable PDF form fields.
Public propertyCustomCSS Use this property to specify some CSS styles that will be injected into the page that is converted.
Public propertyDrawBackground Gets or sets a flag indicating if the HTML page background is rendered in PDF. Default value is true. Setting this property to false can make visible the existing PDF content behind this element.
Public propertyEnableOfflineMode Put the browser into offline mode before navigation, so all network requests fail.
Public propertyFitWideContent Gets or sets whether content wider than the HTML viewer is kept by laying the page out at the width the content needs and scaling it down to fit.
Public propertyForceOutOfProcess Runs this conversion in a separate engine process, whatever ChromiumEngineHostMode says.
Public propertyHtmlDocumentInfo Gets an object populated after conversion with the title, keywords, and description of the converted HTML document. This information can be used for example in the PostConvertActionEvent handler to set the corresponding fields of the PdfDocumentInfo object.
Public propertyHtmlElementsMappingOptions Gets a reference to the object controlling the retrieval of HTML elements position in the generated PDF. In order to retrieve the position in PDF for a list of HTML elements, the HtmlElementIds and HtmlTagNames properties of HtmlElementsMappingOptions must be set with an array of strings containing the HTML IDs and tag names of the HTML elements. The positions of the HTML elements in the generated PDF document will be returned in the HtmlElementsMappingResult object.
Public propertyHtmlExcludedRegionsOptions Gets a reference to the object controlling the exclusion of HTML elements from rendering to PDF. In order to exclude from PDF for a list of HTML elements, the HtmlElementIds and HtmlTagNames properties of HtmlExcludedRegionsOptions must be set with an array of strings containing the HTML IDs or tag names of the HTML elements excluded from conversion to PDF.
Public propertyHttpCache Selects what the rendering engine's HTTP cache keeps from this conversion for the next one.
Public propertyHttpCookies Gets a collection of custom HTTP cookies to be sent by the converter to the web server when the web page to convert and the resources (image, css, etc) referenced by the web page are requested. A cookie is defined by a name and a value pair that can be added to the collection using the Add(string, string) method of the HttpCookies property.
Public propertyHttpHeaders Gets a collection of custom HTTP headers to be sent by the converter to the web server when the web page is requested from a URL. A custom HTTP header is defined by a name and a value pair that can be added to the collection using the Add(string, string) method of the HttpHeaders property. The custom HTTP headers can be used to define cookies, authentication options, URL referer or any other HTTP header to be sent to the web browser. The preferred method to send cookies is to use the HttpCookies property.
Public propertyHttpPostParameters Gets the collection of custom HTTP POST parameters used for the conversion.
Public propertyLanguage The natural language of a tagged PDF (for example "en-US"), recorded as the document language (see Tagged). When not set, the document language defaults to "en-US".
Public propertyLazyImagesLoadingDelay Delay per page, in miliseconds, for lazy images loading.
Public propertyLazyImagesLoadingEnabled Enables a delay mechanism to allow images to fully load.
Public propertyLicenseKey Gets or sets the license key string received from the vendor. If this property is null the converter will automatically enter in evaluation mode and a demo watermark is displayed on the generated PDF document.
Public propertyLoginOptions Handle custom page login.
Public propertyManagedContentTrimming Gets or sets whether the library decides where the rendered content ends on each page. The default is True.
Public propertyManagedContentTrimmingMode Gets or sets how the rendering engine reports where the rendered content ends when ManagedContentTrimming is True. The default is Ink.
Public propertyMaxConversionTime The maximum time in seconds the conversion may take after the page has loaded. Default value is 60.
Public propertyNavigationTimeout The navigation timeout in seconds. Default value is 60. You can increase this timeout is you have a very slow network or when you convert a very big file.
Public propertyPageHeight Gets or sets the height of the HTML document in pixels. The HTML document will be truncated if its height exceeds the specified value of this property. If this parameter is set to 0 or a negative value, the whole HTML document will be converted to PDF. Because all the dimensions in the PDF document are measured in points (1 point is 1/72 inch), it might be necessary to transform pixels to points and points to pixels using the UnitsConverter class in order to better control the HTML to PDF conversion.
Public propertyPageRanges Restrict the generated PDF to a subset of pages, e.g. "1", "2-4", "1-3,5,7-".
Public propertyPageWidth Gets or sets the width of the HTML document in pixels. The default width is 1024 pixels and this value can be changed by setting this property or by specifying the htmlDocWidthPx parameter in the constructor. If this property is set to 0 or a to negative value, the width of the HTML document will be automatically calculated. Because all the dimensions in the PDF document are measured in points (1 point is 1/72 inch), it might be necessary to transform pixels to points and points to pixels using the UnitsConverter class in order to better control the HTML to PDF conversion.
Public propertyPdfBookmarkOptions Gets a reference to the object controlling the bookmarks creation for the rendered PDF document. In order to enable creation of bookmarks you have to set the TagNames property of PdfBookmarkOptions with the names of the HTML tags you want to bookmark.
Public propertyStatic memberPdfConverterConcurrencyLevel This static parameter gives the maximum number of threads in the current .NET application domain that can convert HTML to PDF simultaneously. This parameter must be set before the first conversion performed in the current application domain. When this property is set with a negative value or zero the concurrency level is maximum. The default value is 8.
Public propertyPdfDocumentInfo Gets a reference to the object to controlling the generated PDF document information like the document title, author, subject or creation date.
Public propertyPdfDocumentOptions Gets a reference to the object controlling the conversion process and the generated PDF document properties. This property can be used to control the PDF document margins, PDF compression level, JPEG compression level, the PDF page size and orientation, the PDF document headers and footers, conversion of the URLs to links in PDF, conversion of the HTML links with anchors to internal PDF links, conversion to a single PDF page, append or prepend external PDF documents.
Public propertyPdfFooterOptions Gets a reference to an object to control the generated PDF document footer options. The footer is displayed in the generated PDF document if the PdfDocumentOptions.ShowFooter property is true.
Public propertyPdfHeaderOptions Gets a reference to an object to control the generated PDF document header options. The header is displayed in the generated PDF document if the PdfDocumentOptions.ShowHeader property is true.
Public propertyPdfSecurityOptions Gets a reference to the object to controlling the generated PDF document security settings like user and owner password, restrict printing or editing of the generated PDF document.
Public propertyPdfStandardSubset Defines the PDF subset used by the generated PDF. The default value is Full. This property can be used to instruct the converter to generate PDF/A (PDF/A-1b to PDF/A-4f) or PDF/X-1a compliant documents.
Public propertyPdfViewerPreferences Gets a reference to the object controlling how the generated PDF is displayed by the PDF viewer.
Public propertyPostLoadingScript Use this property to specify some JavaScript code that will be injected into the page that is converted and executed after the page was fully loaded.
Public propertyPostLoadingScriptDelayAfter Delay in miliseconds, after post page loading javascript injection.
Public propertyProxyOptions Gets a reference to an object encapsulating the proxy options used to access the HTML document to convert.
Public propertyRenderElementId Use this property to convert only a certain section of the page, specified by the html element ID.
Public propertyRenderElementSelector Use this property to convert only the part of the page matched by this CSS selector.
Public propertyRenderingEngine Gets or sets the rendering engine used to load and render the HTML, and where it runs: on this machine (Chromium) or in a remote ExpertPdf engine (ChromiumRemote).
Public propertyRenderOnTimeout A flag indicating if the page is rendered even if a navigation timeout occurs. The default value is false and a navigation timeout exception is raised.
Public propertyScriptsEnabled Enable scripts (JavaScript) in the page being converted. By default this property is true.
Public propertyStartupMode Use this property to specify the converter startup mode. By default this is set to Automatic and the conversion is started as soon as the page loads (and ConversionDelay elapses). If set to Manual, the conversion is started only by a javascript call to ExpertPdfJSObj.startConversion()
Public propertyStartupScript Use this property to specify some JavaScript code that will be injected into the page that is converted. The JavaScript code specified here will run before any other script on the page.
Public propertyTableOfContentsOptions Gets a reference to the object controlling the table of contents with page numbers built during the conversion: the page's own table of contents completed with page numbers, one written into the page from its headings, or pages with a table of contents inserted into the PDF document. Nothing is built until its Mode is set.
Public propertyTagged Produce a tagged, accessible PDF (PDF/UA logical structure) from the rendered HTML. The structure (headings, paragraphs, lists, tables, figures with alternate text, links and reading order) comes from the rendering engine's own tagged output and is re-mapped onto the generated document.
Public propertyUsePrintCSSMediaType A flag indicating if @media print css styles are used or not. The default is false and @media screen css styles are used.
Public propertyWebGlEnabled Controls WebGL support in the rendering engine.
Public propertyWindowStatus If set, the converter waits for window.status to match this string before capturing the page.
Top
Methods
 NameDescription
Public methodStatic memberGetPageCount(Stream) A fast method to obtain the page count of a specified PDF document.
Public methodStatic memberGetPageCount(String) A fast method to obtain the page count of a specified PDF document.
Public methodGetPdfBytesFromHtmlFile(String) Converts the specified HTML file to PDF and returns the rendered PDF document as an array of bytes.
Public methodGetPdfBytesFromHtmlFile(String, String) Converts the specified HTML file to PDF and returns the rendered PDF document as an array of bytes.
Public methodGetPdfBytesFromHtmlFileAsync Converts the specified HTML file into a PDF document asynchronously and returns the rendered PDF document as an array of bytes.
Public methodGetPdfBytesFromHtmlStream(Stream, Encoding) Converts the HTML string read from the specified HTML stream to PDF and returns the rendered PDF document as an array of bytes. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfBytesFromHtmlStream(Stream, Encoding, String) Converts the HTML string read from the specified HTML stream 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 htmlStream parameter. 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 GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfBytesFromHtmlStream(Stream, Encoding, String, String) Converts the HTML string read from the specified HTML stream to PDF and returns the rendered PDF document as an array of bytes.
Public methodGetPdfBytesFromHtmlStreamWithTempFile(Stream, Encoding) Converts the HTML string read from the specified HTML stream to PDF and returns the rendered PDF document as an array of bytes. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStreamWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfBytesFromHtmlStreamWithTempFile(Stream, Encoding, String) Converts the HTML string read from the specified HTML stream to PDF and returns the rendered PDF document as an array of bytes. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. The urlBase parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the htmlStream parameter. /// 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 GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfBytesFromHtmlStreamWithTempFile(Stream, Encoding, String, String) Converts the HTML string read from the specified HTML stream to PDF and returns the rendered PDF document as an array of bytes. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodGetPdfBytesFromHtmlString(String) Converts the specified HTML string to PDF and returns the rendered PDF document as an array of bytes. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the internal links, the internal links might not be correctly converted. 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.
Public methodGetPdfBytesFromHtmlString(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.
Public methodGetPdfBytesFromHtmlString(String, String, String) Converts the specified HTML string to PDF and returns the rendered PDF document as an array of bytes.
Public methodGetPdfBytesFromHtmlStringAsync(String, CancellationToken) Converts the specified HTML string into a PDF document asynchronously and returns the rendered PDF document as an array of bytes.
Public methodGetPdfBytesFromHtmlStringAsync(String, String, CancellationToken) Converts the specified HTML string into a PDF document asynchronously and returns the rendered PDF document as an array of bytes.
Public methodGetPdfBytesFromHtmlStringWithTempFile(String) Converts the specified HTML string to PDF and returns the rendered PDF document as an array of bytes. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStringWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfBytesFromHtmlStringWithTempFile(String, String) Converts the specified HTML string to PDF and returns the rendered PDF document as an array of bytes. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. 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 GetPdfBytesFromHtmlStringWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfBytesFromHtmlStringWithTempFile(String, String, String) Converts the specified HTML string to PDF and returns the rendered PDF document as an array of bytes. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodGetPdfBytesFromUrl(String) Converts the specified URL into a PDF document and returns the rendered PDF document as an array of bytes. This method can be used to perform HTML to PDF conversion in internal memory.
Public methodGetPdfBytesFromUrl(String, String) Converts the specified URL into a PDF document and returns the rendered PDF document as an array of bytes. This method can be used to perform HTML to PDF conversion in internal memory.
Public methodGetPdfBytesFromUrlAsync Converts the specified URL into a PDF document asynchronously and returns the rendered PDF document as an array of bytes.
Public methodGetPdfDocumentObjectFromHtmlFile(String) Gets a Document object representing the result of conversion of the specified HTML file to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion.
Public methodGetPdfDocumentObjectFromHtmlFile(String, String) Gets a Document object representing the result of conversion of the specified HTML file to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion.
Public methodGetPdfDocumentObjectFromHtmlStream(Stream, Encoding) Gets a Document object representing the result of conversion of the HTML string read from the specified HTML stream to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfDocumentObjectFromHtmlStream(Stream, Encoding, String) Gets a Document object representing the result of conversion of the HTML string read from the specified HTML stream to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. The urlBase parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the htmlStream parameter. 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 GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfDocumentObjectFromHtmlStream(Stream, Encoding, String, String) Gets a Document object representing the result of conversion of the HTML string read from the specified HTML stream to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion.
Public methodGetPdfDocumentObjectFromHtmlStreamWithTempFile(Stream, Encoding) Gets a Document object representing the result of conversion of the HTML string read from the specified HTML stream to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStreamWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfDocumentObjectFromHtmlStreamWithTempFile(Stream, Encoding, String) Gets a Document object representing the result of conversion of the HTML string read from the specified HTML stream to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. The urlBase parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the htmlStream parameter. 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 GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfDocumentObjectFromHtmlStreamWithTempFile(Stream, Encoding, String, String) Gets a Document object representing the result of conversion of the HTML string read from the specified HTML stream to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodGetPdfDocumentObjectFromHtmlString(String) Gets a Document object representing the result of conversion of the specified HTML string to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the internal links, the internal links might not be correctly converted. 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.
Public methodGetPdfDocumentObjectFromHtmlString(String, String) Gets a Document object representing the result of conversion of the specified HTML string to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. 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.
Public methodGetPdfDocumentObjectFromHtmlString(String, String, String) Gets a Document object representing the result of conversion of the specified HTML string to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion.
Public methodGetPdfDocumentObjectFromHtmlStringAsync Converts the specified HTML string asynchronously and returns a Document object that can be modified and saved.
Public methodGetPdfDocumentObjectFromHtmlStringWithTempFile(String) Gets a Document object representing the result of conversion of the specified HTML string to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStringWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfDocumentObjectFromHtmlStringWithTempFile(String, String) Gets a Document object representing the result of conversion of the specified HTML string to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. 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 GetPdfBytesFromHtmlStringWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodGetPdfDocumentObjectFromHtmlStringWithTempFile(String, String, String) Gets a Document object representing the result of conversion of the specified HTML string to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodGetPdfDocumentObjectFromUrl(String) Gets a Document object representing the result of conversion of the specified URL to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion.
Public methodGetPdfDocumentObjectFromUrl(String, String) Gets a Document object representing the result of conversion of the specified URL to PDF. The resulted Document object can be modified and saved to a file, to a stream, to a memory buffer or to a HTTP response. The Document object must be closed after save to release the system resources used during conversion.
Public methodGetPdfDocumentObjectFromUrlAsync Converts the specified URL asynchronously and returns a Document object that can be modified and saved.
Public methodGetPdfFromUrlBytes Converts the specified URL into a PDF document and returns the rendered PDF document as an array of bytes. This method can be used to perform HTML to PDF conversion in internal memory. This method is obsolete and it was preserved for backward compatibility. It offers the same functionality as the GetPdfBytesFromUrl method which is the preferred method now.
Public methodSavePdfFromHtmlFileToFile(String, String) Converts the specified HTML file into a PDF document and saves the rendered PDF document into the specified disk file.
Public methodSavePdfFromHtmlFileToFile(String, String, String) Converts the specified HTML file into a PDF document and saves the rendered PDF document into the specified disk file.
Public methodSavePdfFromHtmlFileToStream(String, Stream) Converts the specified HTML file to PDF and saves the rendered PDF document to the specified stream.
Public methodSavePdfFromHtmlFileToStream(String, String, Stream) Converts the specified HTML file to PDF and saves the rendered PDF document to the specified stream.
Public methodSavePdfFromHtmlStreamToFile(Stream, Encoding, String) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document into the specified disk file. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the SavePdfFromHtmlStreamToFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamToFile(Stream, Encoding, String, String) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document into the specified disk file. The urlBase parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the htmlStream parameter. 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 SavePdfFromHtmlStreamToFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamToFile(Stream, Encoding, String, String, String) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document into the specified disk file.
Public methodSavePdfFromHtmlStreamToFileWithTempFile(Stream, Encoding, String) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document into the specified disk file. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the SavePdfFromHtmlStreamToFileWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamToFileWithTempFile(Stream, Encoding, String, String) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document into the specified disk file. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. The urlBase parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the htmlStream parameter. 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 SavePdfFromHtmlStreamToFileWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamToFileWithTempFile(Stream, Encoding, String, String, String) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document into the specified disk file. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodSavePdfFromHtmlStreamToStream(Stream, Encoding, Stream) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document to the specified stream. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamToStream(Stream, Encoding, String, Stream) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document to the specified stream. The urlBase parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the htmlStream parameter. 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 GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamToStream(Stream, Encoding, String, String, Stream) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document to the specified stream.
Public methodSavePdfFromHtmlStreamWithTempFileToStream(Stream, Encoding, Stream) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document to the specified stream. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStreamWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamWithTempFileToStream(Stream, Encoding, String, Stream) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document to the specified stream. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. The urlBase parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the htmlStream parameter. /// 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 GetPdfBytesFromHtmlStream method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStreamWithTempFileToStream(Stream, Encoding, String, String, Stream) Converts the HTML string read from the specified HTML stream to PDF and saves the rendered PDF document to the specified stream. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodSavePdfFromHtmlStringToFile(String, String) Converts the specified HTML string to PDF and saves the rendered PDF document into the specified disk file. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the SavePdfFromHtmlStringToFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStringToFile(String, String, String) Converts the specified HTML string to PDF and saves the rendered PDF document into the specified disk file. 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 SavePdfFromHtmlStringToFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStringToFile(String, String, String, String) Converts the specified HTML string to PDF and saves the rendered PDF document into the specified disk file.
Public methodSavePdfFromHtmlStringToFileAsync(String, String, CancellationToken) Converts the specified HTML string into a PDF document asynchronously and saves it to the specified file.
Public methodSavePdfFromHtmlStringToFileAsync(String, String, String, CancellationToken) Converts the specified HTML string into a PDF document asynchronously and saves it to the specified file.
Public methodSavePdfFromHtmlStringToFileWithTempFile(String, String) Converts the specified HTML string to PDF and saves the rendered PDF document into the specified disk file. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the SavePdfFromHtmlStringToFileWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStringToFileWithTempFile(String, String, String) Converts the specified HTML string to PDF and saves the rendered PDF document into the specified disk file. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. 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 SavePdfFromHtmlStringToFileWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStringToFileWithTempFile(String, String, String, String) Converts the specified HTML string to PDF and saves the rendered PDF document into the specified disk file. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodSavePdfFromHtmlStringToStream(String, Stream) Converts the specified HTML string to PDF and saves the rendered PDF document to the specified stream. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the internal links, the internal links might not be correctly converted. 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.
Public methodSavePdfFromHtmlStringToStream(String, String, Stream) Converts the specified HTML string to PDF and saves the rendered PDF document to the specified stream. 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.
Public methodSavePdfFromHtmlStringToStream(String, String, String, Stream) Converts the specified HTML string to PDF and saves the rendered PDF document to the specified stream.
Public methodSavePdfFromHtmlStringToStreamAsync Converts the specified HTML string into a PDF document asynchronously and saves it to the specified stream.
Public methodSavePdfFromHtmlStringWithTempFileToStream(String, Stream) Converts the specified HTML string to PDF and saves the rendered PDF document to the specified stream. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. This method does not use any URL base and therefore the images or CSS files referenced by relative URLs in the HTML string cannot be resolved by the converter to a full URL. Also, because this method does not specify the full URL of the document referenced by the links with anchors, all the links with anchors are considered to be internal links. To make sure the the external resources referenced by relative URLs and the internal links with anchors are correctly resolved by the converter, the GetPdfBytesFromHtmlStringWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStringWithTempFileToStream(String, String, Stream) Converts the specified HTML string to PDF and saves the rendered PDF document to the specified stream. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF. 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 GetPdfBytesFromHtmlStringWithTempFile method with the urlBase and internalLinksDocUrl additional parameters can be used.
Public methodSavePdfFromHtmlStringWithTempFileToStream(String, String, String, Stream) Converts the specified HTML string to PDF and saves the rendered PDF document to the specified stream. The HTML string is first saved into a temporary HTML file. The temporary HTML file is then converted PDF.
Public methodSavePdfFromUrlToFile(String, String) Converts the specified URL into a PDF document and saves the rendered PDF document into the specified disk file.
Public methodSavePdfFromUrlToFile(String, String, String) Converts the specified URL into a PDF document and saves the rendered PDF document into the specified disk file.
Public methodSavePdfFromUrlToFileAsync Converts the specified URL into a PDF document asynchronously and saves it to the specified file.
Public methodSavePdfFromUrlToStream(String, Stream) Converts the specified URL into a PDF document and saves the rendered PDF document to the specified stream.
Public methodSavePdfFromUrlToStream(String, String, Stream) Converts the specified URL into a PDF document and saves the rendered PDF document to the specified stream.
Public methodSavePdfFromUrlToStreamAsync Converts the specified URL into a PDF document asynchronously and saves it to the specified stream.
Top
Events
 NameDescription
Public eventPostConvertActionEvent A event raised by converter before saving the document. The argument of this event offers access to the PDF document created by the converter. The PDF document can be further customized by adding new pages, texts, images, other HTML documents, bookmarks, links, digital signatures, templates and watermarks.
Top
See Also