PageClientPrintToPDFAsync Method |
Version 87.1.132
Print page as PDF.
Namespace:
CefSharp.DevTools.Page
Assembly:
CefSharp (in CefSharp.dll) Version: 87.1.132.0 (87.1.132.0)
Syntax public Task<PrintToPDFResponse> PrintToPDFAsync(
Nullable<bool> landscape = null,
Nullable<bool> displayHeaderFooter = null,
Nullable<bool> printBackground = null,
Nullable<long> scale = null,
Nullable<long> paperWidth = null,
Nullable<long> paperHeight = null,
Nullable<long> marginTop = null,
Nullable<long> marginBottom = null,
Nullable<long> marginLeft = null,
Nullable<long> marginRight = null,
string pageRanges = null,
Nullable<bool> ignoreInvalidPageRanges = null,
string headerTemplate = null,
string footerTemplate = null,
Nullable<bool> preferCSSPageSize = null,
string transferMode = null
)
public:
Task<PrintToPDFResponse^>^ PrintToPDFAsync(
Nullable<bool> landscape = nullptr,
Nullable<bool> displayHeaderFooter = nullptr,
Nullable<bool> printBackground = nullptr,
Nullable<long long> scale = nullptr,
Nullable<long long> paperWidth = nullptr,
Nullable<long long> paperHeight = nullptr,
Nullable<long long> marginTop = nullptr,
Nullable<long long> marginBottom = nullptr,
Nullable<long long> marginLeft = nullptr,
Nullable<long long> marginRight = nullptr,
String^ pageRanges = nullptr,
Nullable<bool> ignoreInvalidPageRanges = nullptr,
String^ headerTemplate = nullptr,
String^ footerTemplate = nullptr,
Nullable<bool> preferCSSPageSize = nullptr,
String^ transferMode = nullptr
)
Parameters
- landscape (Optional)
- Type: SystemNullableBoolean
Paper orientation. Defaults to false. - displayHeaderFooter (Optional)
- Type: SystemNullableBoolean
Display header and footer. Defaults to false. - printBackground (Optional)
- Type: SystemNullableBoolean
Print background graphics. Defaults to false. - scale (Optional)
- Type: SystemNullableInt64
Scale of the webpage rendering. Defaults to 1. - paperWidth (Optional)
- Type: SystemNullableInt64
Paper width in inches. Defaults to 8.5 inches. - paperHeight (Optional)
- Type: SystemNullableInt64
Paper height in inches. Defaults to 11 inches. - marginTop (Optional)
- Type: SystemNullableInt64
Top margin in inches. Defaults to 1cm (~0.4 inches). - marginBottom (Optional)
- Type: SystemNullableInt64
Bottom margin in inches. Defaults to 1cm (~0.4 inches). - marginLeft (Optional)
- Type: SystemNullableInt64
Left margin in inches. Defaults to 1cm (~0.4 inches). - marginRight (Optional)
- Type: SystemNullableInt64
Right margin in inches. Defaults to 1cm (~0.4 inches). - pageRanges (Optional)
- Type: SystemString
Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which meansprint all pages. - ignoreInvalidPageRanges (Optional)
- Type: SystemNullableBoolean
Whether to silently ignore invalid but successfully parsed page ranges, such as '3-2'.Defaults to false. - headerTemplate (Optional)
- Type: SystemString
HTML template for the print header. Should be valid HTML markup with followingclasses used to inject printing values into them:- `date`: formatted print date- `title`: document title- `url`: document location- `pageNumber`: current page number- `totalPages`: total pages in the documentFor example, `<span class=title> </span>` would generate span containing the title. - footerTemplate (Optional)
- Type: SystemString
HTML template for the print footer. Should use the same format as the `headerTemplate`. - preferCSSPageSize (Optional)
- Type: SystemNullableBoolean
Whether or not to prefer page size as defined by css. Defaults to false,in which case the content will be scaled to fit the paper size. - transferMode (Optional)
- Type: SystemString
return as stream
Return Value
Type:
TaskPrintToPDFResponsereturns System.Threading.Tasks.Task<PrintToPDFResponse>
See Also