Click or drag to resize

HtmlToPdfClient Methods

The HtmlToPdfClient type exposes the following members.

Methods
  NameDescription
Public methodconvertHtmlString(String)
Convert the specified HTML string to PDF.
Public methodconvertHtmlString(String, String)
Convert the specified HTML string to PDF. Use a base url to resolve relative paths to resources.
Public methodconvertHtmlStringAsync(String)
Convert the specified HTML string to PDF with an asynchronous call.
Public methodconvertHtmlStringAsync(String, String)
Convert the specified HTML string to PDF with an asynchronous call. Use a base url to resolve relative paths to resources.
Public methodconvertHtmlStringToFile(String, String)
Convert the specified HTML string to PDF and writes the resulted PDF to a local file.
Public methodconvertHtmlStringToFile(String, String, String)
Convert the specified HTML string to PDF and writes the resulted PDF to a local file. Use a base url to resolve relative paths to resources.
Public methodconvertHtmlStringToFileAsync(String, String)
Convert the specified HTML string to PDF with an asynchronous call and writes the resulted PDF to a local file.
Public methodconvertHtmlStringToFileAsync(String, String, String)
Convert the specified HTML string to PDF with an asynchronous call and writes the resulted PDF to a local file. Use a base url to resolve relative paths to resources.
Public methodconvertHtmlStringToStream(String, Stream)
Convert the specified HTML string to PDF and writes the resulted PDF to an output stream.
Public methodconvertHtmlStringToStream(String, String, Stream)
Convert the specified HTML string to PDF and writes the resulted PDF to an output stream. Use a base url to resolve relative paths to resources.
Public methodconvertHtmlStringToStreamAsync(String, Stream)
Convert the specified HTML string to PDF with an asynchronous call and writes the resulted PDF to an output stream.
Public methodconvertHtmlStringToStreamAsync(String, String, Stream)
Convert the specified HTML string to PDF with an asynchronous call and writes the resulted PDF to an output stream. Use a base url to resolve relative paths to resources.
Public methodconvertUrl
Convert the specified url to PDF.
Public methodconvertUrlAsync
Convert the specified url to PDF using an asynchronous call.
Public methodconvertUrlToFile
Convert the specified url to PDF and writes the resulted PDF to a local file.
Public methodconvertUrlToFileAsync
Convert the specified url to PDF with an asynchronous call and writes the resulted PDF to a local file.
Public methodconvertUrlToStream
Convert the specified url to PDF and writes the resulted PDF to an output stream.
Public methodconvertUrlToStreamAsync
Convert the specified url to PDF with an asynchronous call and writes the resulted PDF to an output stream.
Public methodgetNumberOfPages
Get the number of pages of the PDF document resulted from the API call.
Public methodgetWebElements
Get the locations of certain web elements. This is retrieved if pdf_web_elements_selectors parameter is set and elements were found to match the selectors.
Public methodsetBackgroundColor
Specify the background color of the PDF page in RGB html format. The default is #FFFFFF.
Public methodsetConversionDelay
Introduce a delay (in seconds) before the actual conversion to allow the web page to fully load.
Public methodsetCookies
Set HTTP cookies for the web page being converted.
Public methodsetCustomParameter
Set a custom parameter. Do not use this method unless advised by SelectPdf.
Public methodsetDisableExternalLinks
Do not create external links in the PDF. The default value is False and external links are created.
Public methodsetDisableInternalLinks
Do not create internal links in the PDF. The default value is False and internal links are created.
Public methodsetDisableJavascript
Do not run JavaScript in web pages. The default value is False and javascript is executed.
Public methodsetDocAddCreationDate
Add the date and time when the PDF document was created to the PDF document information. The default value is False.
Public methodsetDocAuthor
Set the name of the PDF document author.
Public methodsetDocKeywords
Set the PDF document keywords.
Public methodsetDocSubject
Set the subject of the PDF document.
Public methodsetDocTitle
Set the PDF document title.
Public methodsetDrawHtmlBackground
Set a flag indicating if the web page background is rendered in PDF. The default value is True.
Public methodsetFooterBaseUrl
Set an optional base url parameter can be used together with the footer HTML to resolve relative paths from the html string.
Public methodsetFooterDisplayOnEvenPages
Control the visibility of the footer on the even numbered pages of the generated pdf document. The default value is True.
Public methodsetFooterDisplayOnFirstPage
Control the visibility of the footer on the first page of the generated pdf document. The default value is True.
Public methodsetFooterDisplayOnLastPage
Add a special footer on the last page of the generated pdf document only. The default value is False.
Public methodsetFooterDisplayOnOddPages
Control the visibility of the footer on the odd numbered pages of the generated pdf document. The default value is True.
Public methodsetFooterHeight
The height of the pdf document footer. This height is specified in points. 1 point is 1/72 inch. The default value is 50.
Public methodsetFooterHtml
Set the raw html that is converted and rendered in the pdf document footer.
Public methodsetFooterUrl
Set the url of the web page that is converted and rendered in the PDF document footer.
Public methodsetFooterWebPageHeight
Set the height in pixels used by the converter's internal browser window during the conversion of the footer content. The default value is 0px and it means that the page height is automatically calculated by the converter.
Public methodsetFooterWebPageWidth
Set the width in pixels used by the converter's internal browser window during the conversion of the footer content. The default value is 1024px.
Public methodsetHeaderBaseUrl
Set an optional base url parameter can be used together with the header HTML to resolve relative paths from the html string.
Public methodsetHeaderDisplayOnEvenPages
Control the visibility of the header on the even numbered pages of the generated pdf document. The default value is True.
Public methodsetHeaderDisplayOnFirstPage
Control the visibility of the header on the first page of the generated pdf document. The default value is True.
Public methodsetHeaderDisplayOnOddPages
Control the visibility of the header on the odd numbered pages of the generated pdf document. The default value is True.
Public methodsetHeaderHeight
The height of the pdf document header. This height is specified in points. 1 point is 1/72 inch. The default value is 50.
Public methodsetHeaderHtml
Set the raw html that is converted and rendered in the pdf document header.
Public methodsetHeaderUrl
Set the url of the web page that is converted and rendered in the PDF document header.
Public methodsetHeaderWebPageHeight
Set the height in pixels used by the converter's internal browser window during the conversion of the header content. The default value is 0px and it means that the page height is automatically calculated by the converter.
Public methodsetHeaderWebPageWidth
Set the width in pixels used by the converter's internal browser window during the conversion of the header content. The default value is 1024px.
Public methodsetKeepImagesTogether
Avoid breaking images between PDF pages. The default value is False and images are split between pages if larger.
Public methodsetMarginBottom
Set bottom margin of the PDF pages. Default value is 5pt.
Public methodsetMarginLeft
Set left margin of the PDF pages. Default value is 5pt.
Public methodsetMarginRight
Set right margin of the PDF pages. Default value is 5pt.
Public methodsetMargins
Set all margins of the PDF pages to the same value. Default value is 5pt.
Public methodsetMarginTop
Set top margin of the PDF pages. Default value is 5pt.
Public methodsetMaxLoadTime
Set the maximum amount of time (in seconds) that the converter will wait for the page to load.
Public methodsetMinLoadTime
Introduce a delay (in seconds) before the actual conversion to allow the web page to fully load.
Public methodsetNavigationTimeout
Set the maximum amount of time (in seconds) that the converter will wait for the page to load.
Public methodsetOwnerPassword
Set PDF owner password.
Public methodsetPageBreaksEnhancedAlgorithm
Get or set a flag indicating if an enhanced custom page breaks algorithm is used. The enhanced algorithm is a little bit slower but it will prevent the appearance of hidden text in the PDF when custom page breaks are used. The default value for this property is False.
Public methodsetPageHeight
Set PDF page height in points. Default value is 842pt (A4 page height in points). 1pt = 1/72 inch.
Public methodsetPageNumbersAlignment
Set the alignment of the page numbers text. The default value is PageNumbersAlignment.Right.
Public methodsetPageNumbersColor
Specify the color of the page numbers text in #RRGGBB html format. The default value is #333333.
Public methodsetPageNumbersFirst
Control the page number for the first page being rendered. The default value is 1.
Public methodsetPageNumbersFontName
Set the font used to display the page numbers text. The default value is "Helvetica".
Public methodsetPageNumbersFontSize
Set the size of the font used to display the page numbers. The default value is 10 points.
Public methodsetPageNumbersOffset
Control the total number of pages offset in the generated pdf document. The default value is 0.
Public methodsetPageNumbersTemplate
Set the text that is used to display the page numbers. It can contain the placeholder {page_number} for the current page number and {total_pages} for the total number of pages. The default value is "Page: {page_number} of {total_pages}".
Public methodsetPageNumbersVerticalPosition
Specify the position in points on the vertical where the page numbers text is displayed in the footer. The default value is 10 points.
Public methodsetPageOrientation
Set PDF page orientation. Default value is Portrait.
Public methodsetPageSize
Set PDF page size. Default value is A4.
Public methodsetPageWidth
Set PDF page width in points. Default value is 595pt (A4 page width in points). 1pt = 1/72 inch.
Public methodsetPdfBookmarksSelectors
Generate automatic bookmarks in pdf. The elements that will be bookmarked are defined using CSS selectors. For example, the selector for all the H1 elements is "H1", the selector for all the elements with the CSS class name 'myclass' is "*.myclass" and the selector for the elements with the id 'myid' is "*#myid". Read more about CSS selectors here.
Public methodsetPdfHideElements
Exclude page elements from the conversion. The elements that will be excluded are defined using CSS selectors. For example, the selector for all the H1 elements is "H1", the selector for all the elements with the CSS class name 'myclass' is "*.myclass" and the selector for the elements with the id 'myid' is "*#myid". Read more about CSS selectors here.
Public methodsetPdfName
Specify the name of the pdf document that will be created. The default value is Document.pdf.
Public methodsetPdfShowOnlyElementID
Convert only a specific section of the web page to pdf. The section that will be converted to pdf is specified by the html element ID. The element can be anything (image, table, table row, div, text, etc).
Public methodsetPdfWebElementsSelectors
Get the locations of page elements from the conversion. The elements that will have their locations retrieved are defined using CSS selectors. For example, the selector for all the H1 elements is "H1", the selector for all the elements with the CSS class name 'myclass' is "*.myclass" and the selector for the elements with the id 'myid' is "*#myid". Read more about CSS selectors here.
Public methodsetRenderingEngine
Set the rendering engine used for the HTML to PDF conversion. Default value is WebKit.
Public methodsetRenderOnTimeout
Try to render the PDF even in case of the web page loading timeout. The default value is False and an exception is raised in case of web page navigation timeout.
Public methodsetScaleImages
Set a flag indicating if the images from the page are scaled during the conversion process. The default value is False and images are not scaled.
Public methodsetSecureProtocol
Set the protocol used for secure (HTTPS) connections.
Public methodsetShowFooter
Control if a custom footer is displayed in the generated PDF document. The default value is False.
Public methodsetShowHeader
Control if a custom header is displayed in the generated PDF document. The default value is False.
Public methodsetShowPageNumbers
Show page numbers. Default value is True.
Public methodsetSinglePagePdf
Generate a single page PDF. The converter will automatically resize the PDF page to fit all the content in a single page. The default value of this property is False and the PDF will contain several pages if the content is large.
Public methodsetSkipDecoding
Internal use only.
Public methodsetStartupMode
Set converter startup mode. The default value is StartupMode.Automatic and the conversion is started immediately.
Public methodsetUseCssPrint
Specify if the CSS Print media type is used instead of the Screen media type. The default value is False.
Public methodsetUserPassword
Set PDF user password.
Public methodsetViewerCenterWindow
Set a flag specifying whether to position the document's window in the center of the screen. The default value is False.
Public methodsetViewerDisplayDocTitle
Set a flag specifying whether the window's title bar should display the document title taken from document information. The default value is False.
Public methodsetViewerFitWindow
Set a flag specifying whether to resize the document's window to fit the size of the first displayed page. The default value is False.
Public methodsetViewerHideMenuBar
Set a flag specifying whether to hide the pdf viewer application's menu bar when the document is active. The default value is False.
Public methodsetViewerHideToolbar
Set a flag specifying whether to hide the pdf viewer application's tool bars when the document is active. The default value is False.
Public methodsetViewerHideWindowUI
Set a flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed. The default value is False.
Public methodsetViewerPageLayout
Set the page layout to be used when the document is opened in a PDF viewer. The default value is PageLayout.OneColumn.
Public methodsetViewerPageMode
Set the document page mode when the pdf document is opened in a PDF viewer. The default value is PageMode.UseNone.
Public methodsetWebPageHeight
Set the height used by the converter's internal browser window in pixels. The default value is 0px and it means that the page height is automatically calculated by the converter.
Public methodsetWebPageWidth
Set the width used by the converter's internal browser window in pixels. The default value is 1024px.
Top
See Also