Aller au contenu principal

PrintToPDFOptions Object

  • landscape boolean (optional) - Paper orientation.true for landscape, false for portrait. false par défaut.
  • displayHeaderFooter boolean (optional) - Whether to display header and footer. false par défaut.
  • printBackground boolean (optional) - Whether to print background graphics. false par défaut.
  • scale number(optional) - Scale of the webpage rendering. 1 par défaut.
  • pageSize string | Size (optional) - Specify page size of the generated PDF. Can be A0, A1, A2, A3, A4, A5, A6, Legal, Letter, Tabloid, Ledger, or an Object containing height and width in inches. Defaults to Letter.
  • margins PrintToPDFMargins (optional)
    • top number (optional) - Top margin in inches. 1cm par défaut (~0.4 pouce).
    • bottom number (optional) - Bottom margin in inches. 1cm par défaut (~0.4 pouce).
    • left number (optional) - Left margin in inches. 1cm par défaut (~0.4 pouce).
    • right number (optional) - Right margin in inches. 1cm par défaut (~0.4 pouce).
  • pageRanges string (optional) - Page ranges to print, e.g., '1-5, 8, 11-13'. Par défaut: une chaîne vide, signifiant d'afficher toutes les pages.
  • headerTemplate string (optional) - HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: date (formatted print date), title (document title), url (document location), pageNumber (current page number) and totalPages (total pages in the document). For 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 boolean (optional) - Whether or not to prefer page size as defined by css. Faux par défaut, auquel cas le contenu sera mis à l'échelle pour s'adapter à la taille du papier.
  • generateTaggedPDF boolean (optional) Experimental - Whether or not to generate a tagged (accessible) PDF. false par défaut. As this property is experimental, the generated PDF may not adhere fully to PDF/UA and WCAG standards.
  • generateDocumentOutline boolean (optional) Experimental - Whether or not to generate a PDF document outline from content headers. false par défaut.