Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions wants/cfc30575-7abc-4638-ad62-61fc320552c1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "I want a browser API to automate print and save-as-PDF"
date: 2023-08-03T13:24:57.667Z
submitter: "Anonymous"
number: cfc30575-7abc-4638-ad62-61fc320552c1
tags:
- api
- javascript
discussion: "https://github.com/WebWeWant/webwewant.fyi/discussions/633"
status: "discussing"
related:
- title: "Window.print() - Web APIs | MDN"
url: "https://developer.mozilla.org/en-US/docs/Web/API/Window/print"
type: article
- title: "File System Access API"
url: "https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API"
type: article
- title: "CSS Paged Media Module Level 3"
url: "https://www.w3.org/TR/css-page-3/"
type: spec
---

I build data-viewing web applications and I regularly need to print multiple views of a session to PDF — for example, different files with the same viewing parameters. Right now I have to trigger each print manually through the browser's print dialog and save each PDF one at a time.

I want a browser API that lets me programmatically trigger the browser's built-in "Save as PDF" functionality, ideally integrated with the [File System Access API](https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API) so I can select a destination folder and batch-save multiple PDFs without any user interaction per file.

JavaScript PDF-generation libraries exist, but they cannot match the fidelity of the browser's native print-to-PDF rendering, which correctly handles CSS paged media, fonts, and layout. Exposing this capability as a first-class web API would unlock powerful automation for reporting, document generation, and data export workflows.

Loading