(Created on )

Puppeteer: Failed to parse parameter value:

A PDF dimension string cannot be parsed as a number.


A PDF dimension string cannot be parsed as a number.

Error message

Failed to parse parameter value:

How this error happens

A PDF dimension string must contain a number with a supported unit. wide cannot be converted into a page width.

The snippets use an open Puppeteer page named page.

await page.pdf({
    width: "wide",
    height: "297mm",
});

How to fix

Supply a numeric dimension, optionally followed by px, in, cm or mm.

await page.pdf({
    width: "210mm",
    height: "297mm",
});

Things to keep in mind

A CSS expression such as calc(100% - 20px) is not a PDF dimension. Calculate the size before calling pdf.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →