PDFViewer.print()
Ask for pages and annotations (or take them from
options), render at 300 DPI (within performance.maxRenderPixels) with progress, and open the browser print dialog. Needs the print feature.methodExport and printsince 1.0.0
Signature
print(options?: PrintOptions): Promise<void>
Parameters
| Parameter | Type | Description |
|---|---|---|
| options? | PrintOptions | { pages?: number[]; annotations?: boolean } — the pages to print (zero-based; every page when omitted) and whether annotations are printed (true when omitted). Without it the viewer asks for pages and annotations. |
Returns
Promise<void> Resolves when the browser reports the print dialog closed (afterprint), or after a minute where it never does.
Throws
INVALID_ARGUMENTfor apageslist that is empty or names a page the document has not.FEATURE_NOT_LICENSEDwithout theprintfeature.PERMISSION_DENIEDwhen the document forbids printing.INVALID_STATEafterdestroy().
Example
TypeScript
await viewer.print({ pages: [0, 1], annotations: false });