feat: complete OpenAPI docs with all Puppeteer PDF options
Some checks failed
Build & Deploy to Staging / Build & Deploy to Staging (push) Has been cancelled

- Add scale, pageRanges, preferCSSPageSize, width, height to PdfOptions
- Add headerTemplate, footerTemplate, displayHeaderFooter to docs
- Pass all options through routes to browser service for HTML, Markdown, and URL endpoints
- Export PdfRenderOptions interface for type reuse
- Bump version to 0.4.5
This commit is contained in:
DocFast Bot 2026-02-21 13:19:31 +00:00
parent f332d425ec
commit 1545df9a7b
5 changed files with 111 additions and 21 deletions

View file

@ -49,7 +49,7 @@ const options: swaggerJsdoc.Options = {
type: "string",
enum: ["A4", "Letter", "Legal", "A3", "A5", "Tabloid"],
default: "A4",
description: "Page size",
description: "Page size. Ignored if width/height are set.",
},
landscape: {
type: "boolean",
@ -58,6 +58,7 @@ const options: swaggerJsdoc.Options = {
},
margin: {
type: "object",
description: "Page margins. Accepts CSS units (e.g. '20mm', '1in', '72px').",
properties: {
top: { type: "string", example: "20mm" },
bottom: { type: "string", example: "20mm" },
@ -68,12 +69,53 @@ const options: swaggerJsdoc.Options = {
printBackground: {
type: "boolean",
default: true,
description: "Print background graphics",
description: "Print background graphics and colors",
},
filename: {
type: "string",
default: "document.pdf",
description: "Suggested filename for the PDF",
description: "Suggested filename for the PDF download",
},
headerTemplate: {
type: "string",
description: "HTML template for the page header. Requires displayHeaderFooter: true. Use these CSS classes for dynamic values: date, title, url, pageNumber, totalPages. Example: '<span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span>'",
},
footerTemplate: {
type: "string",
description: "HTML template for the page footer. Requires displayHeaderFooter: true. Supports the same CSS classes as headerTemplate.",
},
displayHeaderFooter: {
type: "boolean",
default: false,
description: "Whether to show header and footer templates. Must be true for headerTemplate/footerTemplate to render.",
},
scale: {
type: "number",
minimum: 0.1,
maximum: 2,
default: 1,
description: "Scale of the webpage rendering. 1 = 100%, 0.5 = 50%, 2 = 200%.",
example: 1,
},
pageRanges: {
type: "string",
description: "Paper ranges to print, e.g. '1-5', '1,3,5', '2-4,6'. Empty string means all pages.",
example: "1-3",
},
preferCSSPageSize: {
type: "boolean",
default: false,
description: "Give any CSS @page size declared in the page priority over the format option.",
},
width: {
type: "string",
description: "Paper width with units. Overrides format. Accepts CSS units (e.g. '10in', '210mm', '8.5in').",
example: "8.5in",
},
height: {
type: "string",
description: "Paper height with units. Overrides format. Accepts CSS units (e.g. '11in', '297mm').",
example: "11in",
},
},
},