pdfoptions

command
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Command pdfoptions is a chromedp example demonstrating how to print a page to PDF files with different options of chromedp.PrintToPDF. The program serves a document of five pages from a local server and prints it in several variants: the default, landscape, A4 with margins and backgrounds, a header and a footer with the title and the page number, a scale of 2, only the pages 2 to 3, and a file with an outline and tags that the browser sends as a stream. It also prints a page that sets its own paper size with the CSS rule @page, and uses the option PDFPreferCSSPageSize for it. The program writes the files in the directory of the flag -out, or in a new temporary directory that it prints. For each file it prints the number of pages and the size of the first page, which it reads from the file itself. It starts a local server and needs no internet. Use -v to print the protocol messages, -visible to show the browser window and leave it open, and -visible-on-terminal to draw the page in the terminal with terminal graphics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL