PageClientPrintToPDFAsync Method |
Version 130.1.90
Print page as PDF.
Namespace: CefSharp.DevTools.PageAssembly: CefSharp.Core (in CefSharp.Core.dll) Version: 129.0.110.0
Syntax public Task<PrintToPDFResponse> PrintToPDFAsync(
bool? landscape = null,
bool? displayHeaderFooter = null,
bool? printBackground = null,
double? scale = null,
double? paperWidth = null,
double? paperHeight = null,
double? marginTop = null,
double? marginBottom = null,
double? marginLeft = null,
double? marginRight = null,
string pageRanges = null,
string headerTemplate = null,
string footerTemplate = null,
bool? preferCSSPageSize = null,
PrintToPDFTransferMode? transferMode = null,
bool? generateTaggedPDF = null,
bool? generateDocumentOutline = null
)
public:
Task<PrintToPDFResponse^>^ PrintToPDFAsync(
Nullable<bool> landscape = nullptr,
Nullable<bool> displayHeaderFooter = nullptr,
Nullable<bool> printBackground = nullptr,
Nullable<double> scale = nullptr,
Nullable<double> paperWidth = nullptr,
Nullable<double> paperHeight = nullptr,
Nullable<double> marginTop = nullptr,
Nullable<double> marginBottom = nullptr,
Nullable<double> marginLeft = nullptr,
Nullable<double> marginRight = nullptr,
String^ pageRanges = nullptr,
String^ headerTemplate = nullptr,
String^ footerTemplate = nullptr,
Nullable<bool> preferCSSPageSize = nullptr,
Nullable<PrintToPDFTransferMode> transferMode = nullptr,
Nullable<bool> generateTaggedPDF = nullptr,
Nullable<bool> generateDocumentOutline = nullptr
)
Parameters
- landscape NullableBoolean (Optional)
- Paper orientation. Defaults to false.
- displayHeaderFooter NullableBoolean (Optional)
- Display header and footer. Defaults to false.
- printBackground NullableBoolean (Optional)
- Print background graphics. Defaults to false.
- scale NullableDouble (Optional)
- Scale of the webpage rendering. Defaults to 1.
- paperWidth NullableDouble (Optional)
- Paper width in inches. Defaults to 8.5 inches.
- paperHeight NullableDouble (Optional)
- Paper height in inches. Defaults to 11 inches.
- marginTop NullableDouble (Optional)
- Top margin in inches. Defaults to 1cm (~0.4 inches).
- marginBottom NullableDouble (Optional)
- Bottom margin in inches. Defaults to 1cm (~0.4 inches).
- marginLeft NullableDouble (Optional)
- Left margin in inches. Defaults to 1cm (~0.4 inches).
- marginRight NullableDouble (Optional)
- Right margin in inches. Defaults to 1cm (~0.4 inches).
- pageRanges String (Optional)
- Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages areprinted in the document order, not in the order specified, and nomore than once.Defaults to empty string, which implies the entire document is printed.The page numbers are quietly capped to actual page count of thedocument, and ranges beyond the end of the document are ignored.If this results in no pages to print, an error is reported.It is an error to specify a range with start greater than end.
- headerTemplate String (Optional)
- 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 String (Optional)
- HTML template for the print footer. Should use the same format as the `headerTemplate`.
- preferCSSPageSize NullableBoolean (Optional)
- 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 NullablePrintToPDFTransferMode (Optional)
- return as stream
- generateTaggedPDF NullableBoolean (Optional)
- Whether or not to generate tagged (accessible) PDF. Defaults to embedder choice.
- generateDocumentOutline NullableBoolean (Optional)
- Whether or not to embed the document outline into the PDF.
Return Value
TaskPrintToPDFResponsereturns System.Threading.Tasks.Task<PrintToPDFResponse>
See Also