Short answer: you cannot set PDF document title or author through Puppeteer’s documented page.pdf() options. Generate the PDF first, load the resulting bytes with a PDF library such as pdf-lib, call setTitle() and setAuthor(), then save the updated document. These fields are document metadata; they do not add a visible heading or byline to the page.
Puppeteer’s current PDFOptions reference (shown as version 25.12.0 when consulted) lists print settings, margins, backgrounds, output paths and related controls, but no title or author option: PDFOptions reference. The reliable workflow is therefore a two-stage pipeline: Chromium renders the pages, and a PDF library writes the document information fields.
What Puppeteer can and cannot set
page.pdf() creates a PDF using the print media type and returns a Promise<Uint8Array>. You can also provide a path option to have Puppeteer write the generated file, as shown in the Page.pdf() API and PDF generation guide. Neither documented API lists document-level title or author metadata fields.
Do not confuse three different things:
- Visible content: text rendered on the page, such as an
<h1>or byline. - Browser or file name: what your operating system shows for the saved file.
- PDF document information: fields exposed in a reader’s Document Properties dialog, including title and author.
The metadata setters change the third item only. If readers must see a title on the first page, add it to your HTML or template separately.
#1 Best Overall
- EDIT text, images & designs in PDF documents. ORGANIZE PDFs. Convert PDFs to Word, Excel & ePub.
- READ and Comment PDFs – Intuitive reading modes & document commenting and mark up.
- CREATE, COMBINE, SCAN and COMPRESS PDFs
- FILL forms & Digitally Sign PDFs. PROTECT and Encrypt PDFs
- LIFETIME License for 1 Windows PC or Laptop. 5GB MobiDrive Cloud Storage Included.
Install the required packages
Use a current Node.js project and install Puppeteer and pdf-lib:
npm install puppeteer pdf-lib
Puppeteer downloads a compatible browser during installation unless your project is configured to use an existing executable. If you manage Chromium yourself, make sure the executable is compatible with the Puppeteer version you install.
Generate a PDF and write title and author metadata
The following complete script keeps the PDF in memory until metadata has been added. It follows Puppeteer’s documented byte-returning API and pdf-lib’s documented setTitle() and setAuthor() methods.
import puppeteer from 'puppeteer';
import { PDFDocument } from 'pdf-lib';
import { writeFile } from 'node:fs/promises';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
const puppeteerBytes = await page.pdf({
format: 'A4',
printBackground: true,
preferCSSPageSize: true
});
const pdfDoc = await PDFDocument.load(puppeteerBytes);
pdfDoc.setTitle('Quarterly Report');
pdfDoc.setAuthor('Example Company');
const updatedBytes = await pdfDoc.save();
await writeFile('report.pdf', updatedBytes);
} finally {
await browser.close();
}
Run it as an ES module (for example, save it as generate-report.mjs and run node generate-report.mjs). Replace the URL and metadata values with your own. The try/finally block closes Chromium even if navigation, PDF generation or metadata editing fails.
Using a local HTML file or application route
For a local file, use a file:// URL created with Node’s path utilities, or serve the page from your application and navigate to its HTTP URL. For authenticated pages, establish cookies or headers before calling page.pdf(); metadata editing is independent of navigation.
Writing the first PDF to disk
If your pipeline already writes a file with Puppeteer’s path option, read that file, load it with pdf-lib, and overwrite it only after save() succeeds:
const firstBytes = await page.pdf({ path: 'draft.pdf', format: 'A4' });
// firstBytes is also returned; alternatively read draft.pdf here.
const pdfDoc = await PDFDocument.load(firstBytes);
pdfDoc.setTitle('Quarterly Report');
pdfDoc.setAuthor('Example Company');
await writeFile('report.pdf', await pdfDoc.save());
Saving to a separate final path avoids leaving a partially replaced file if the second stage throws. If you must replace the original, write to a temporary file and rename it after a successful save.
Control what appears on the page
Metadata does not create visible text. Add a title and byline in the HTML used by Puppeteer:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- Fast PDF reader with read aloud, night mode, reading mode, search and bookmarks
- Highlight, underline, draw, add notes and text on any PDF
- Fill PDF forms, sign documents with your finger and protect PDFs with a password
- Convert PDF to Word or JPG; merge, extract and reorder pages; scan with your camera
- Works on Fire TV: send PDFs from your phone over Wi-Fi and read them on the big screen
<article>
<h1>Quarterly Report</h1>
<p class="byline">Prepared by Example Company</p>
<!-- report content -->
</article>
Then use CSS for print layout. The document metadata and the printed heading can intentionally match, but they are maintained separately and can also differ (for example, a short visible heading with a longer catalog title).
Choose metadata values deliberately
Title
Set a descriptive, stable name such as 2026 Q3 Revenue Report, not a temporary filename or URL. pdf-lib documents that the title appears in the Document Properties section of most PDF readers.
Author
Use the person, team or organization responsible for the document. If several contributors need credit, choose a consistent string (for example, Analytics Team) or maintain additional credits in the visible document body.
Reader title-bar behavior
pdf-lib also exposes an option intended to make readers display the title instead of the filename:
pdfDoc.setTitle('Quarterly Report', { showInWindowTitleBar: true });
The library describes this as working for most readers, not as a universal requirement. Window-title behavior depends on the PDF application, so do not use it as a substitute for verification.
Verify the final file
When metadata matters for indexing, archiving or compliance, inspect the exact bytes delivered to users after every transformation. You can read the fields back with pdf-lib:
import { readFile } from 'node:fs/promises';
import { PDFDocument } from 'pdf-lib';
const bytes = await readFile('report.pdf');
const pdfDoc = await PDFDocument.load(bytes);
console.log({
title: pdfDoc.getTitle(),
author: pdfDoc.getAuthor()
});
You can also open the file’s Document Properties panel in your target desktop or browser PDF reader. Different readers may display metadata differently; the PDF specification defines title and author as optional document information intended to help cataloging and searching. Apple’s PDFKit likewise describes title and author as optional text attributes: PDFDocumentTitleAttribute. The specification excerpt is available at PDF 32000-1:2008 metadata excerpt.
Common errors and fixes
“Unknown option” or TypeScript rejects title
Cause: title and author are not documented PDFOptions properties.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsRank #3
- Edit PDFs with Ease. Modify text, images, and layouts directly within your PDF documents.
- Convert & Organize. Export PDFs to Word, Excel, or ePub, and organize files with ease.
- Read & Annotate. Enjoy intuitive reading modes and powerful tools to comment, highlight, and mark up PDFs.
- Create & Manage PDFs. Create new PDFs, combine multiple files, scan documents, and compress for easy sharing.
- Fill & Sign Forms. Complete forms and digitally sign documents with secure e-signature tools.
Fix: remove them from page.pdf() and set them on the loaded PDFDocument with setTitle() and setAuthor().
PDFDocument.load() reports an invalid or truncated PDF
Cause: the input is not the completed PDF bytes, an HTTP response or an incomplete file was passed instead.
Fix: await page.pdf() fully, pass its returned Uint8Array directly, or wait for the file write to finish before reading it. Confirm that the buffer begins with a valid PDF produced by Puppeteer.
The file has metadata but no visible title
Cause: metadata and page content are separate.
Fix: add an HTML heading/byline and style it for print; keep the metadata setters for document properties.
Free tools Windows power users keep installed
One-click scans. No signup required.
Metadata appears in one reader but not another
Cause: reader UIs and title-bar policies vary. The pdf-lib title-bar option is qualified as working for most readers.
Fix: inspect the file with the readers and indexing tools your users actually rely on. Treat read-back verification as the authoritative check for the stored fields.
Browser remains running after a failure
Cause: the process exited before cleanup.
Fix: put generation in a try/finally block and close the browser in finally, as in the complete example.
Navigation times out before PDF generation
Cause: the page has not reached the selected readiness condition, has slow resources or requires authentication.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #4
- All-in-one office pack - Documents, Sheets, Slides & PDF
- Cross-platform (Android, iOS, Windows PC)
- Supports Microsoft Office formats
- Use 30+ charts & 250+ formulas in Sheets
- In-depth features for document creation & formatting
Fix: establish authentication first, select an appropriate waitUntil condition, and add an explicit wait for application content when necessary. A longer navigation timeout does not correct a page that never becomes ready.
Performance, reliability and file handling
- Memory: the in-memory approach holds the Chromium output and the rewritten PDF at different points in the process. For very large documents, monitor process memory and prefer a temporary-file pipeline if your deployment has strict limits.
- Two processing stages: Chromium performs layout, fonts, images and pagination; pdf-lib parses and rewrites the PDF. Keep both stages in the same job so the file you verify is the file you publish.
- Fonts and assets: wait for the page’s required content before calling
page.pdf(). Print output can be correct while metadata is correct, but metadata editing cannot repair missing fonts or unloaded images. - Atomic delivery: write the edited bytes to a temporary destination, verify them, then rename or upload the final file. This prevents consumers from receiving a half-written PDF.
- Deterministic metadata: pass explicit title and author strings instead of relying on whatever defaults a particular Chromium version may emit. The consulted Puppeteer documentation does not promise specific default metadata values.
Alternative libraries and platform considerations
pdf-lib is a documented JavaScript choice because it can load an existing PDF and exposes the required setters. Other platforms have their own APIs; for example, Apple PDFKit defines title and author attributes. Choose a library that can read the PDF generated by your pipeline, modify document information, and save a valid PDF in your runtime. The available references do not establish a comprehensive performance or compatibility ranking among libraries, so validate your chosen combination with representative files.
Or skip the browser setup
If your actual goal is a hosted screenshot or PDF capture rather than a custom Puppeteer job, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP tools—take_screenshot, get_page_info and capture_pdf—work with Claude, Cursor and other MCP clients.
The one-call request is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
For API options and PDF capture details, see the ScreenshotNeo documentation. The free plan includes 1,000 screenshots each month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.
Recommended Free Tools
FAQ
Can I set metadata after sending the PDF response?
No. Once bytes have been sent, change the PDF, save it and send the resulting bytes instead. HTTP headers such as Content-Disposition do not write PDF document metadata.
Does setting a PDF title rename the file?
No. The filename is controlled by your path or download headers. The title is stored inside the PDF and shown by compatible readers.
Will pdf-lib preserve my pages and print settings?
It loads and saves the existing PDF, but you should validate representative output in your own application, especially when documents contain unusual annotations, forms or advanced features.
Frequently Asked Questions
Can I set metadata on a PDF that Puppeteer already saved?
Yes. Read the saved file into pdf-lib, call setTitle() and setAuthor(), save the result to a final file, and verify that final file.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Are title and author required PDF fields?
No. They are optional document-information fields; set them when cataloging, search or reader properties matter.
Does the metadata change what is printed on the page?
No. Add visible headings and bylines to the HTML separately.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

