hubcap pdf

Export the current page as a PDF document.

When to use

Use pdf to export the current page as a PDF file. Use screenshot for image capture instead.

Usage

hubcap pdf --output <file> [flags]

Arguments

None.

Flags

FlagTypeDefaultDescription
—outputstring""File path to save the PDF (required)
—landscapeboolfalseLandscape orientation
—backgroundboolfalsePrint background graphics

Output

FieldTypeDescription
outputstringPath to the saved PDF file
sizeintFile size in bytes
landscapeboolWhether landscape was used
{"output":"page.pdf","size":54321,"landscape":false}

Errors

ConditionExit codeStderr
Missing —output1usage: hubcap pdf --output <file> [--landscape] [--background]
Chrome not connected2error: connecting to Chrome: ...
Timeout3error: timeout

Examples

Export a basic PDF:

hubcap pdf --output page.pdf

Export in landscape with backgrounds:

hubcap pdf --output report.pdf --landscape --background

Navigate to a page and export as PDF (chaining):

hubcap goto --wait https://example.com && hubcap pdf --output example.pdf

See also

  • screenshot - Capture a screenshot of the page
  • goto - Navigate to a URL