Save web articles and documentation as PDF for your archive
Save a web article as PDF with one API call and keep a copy that survives edits, paywalls and dead links. Research teams, legal and compliance desks, newsroom libraries and read-it-later apps all need the same thing: a document that reads offline, can be searched and attaches to a ticket. The PDF API prints the article the way its print stylesheet intends, with the noise removed and only the pages you need.
Bookmarks rot, and a screenshot of an article cannot be searched
A bookmarked article can be paywalled, edited or deleted a year later, and the link in your notes quietly turns into a 404. What you cited is no longer what the page says, and there is no copy to check against.
The common workarounds each lose something. A screenshot preserves pixels but not text, so it cannot be searched or quoted. Copy-pasting into a document drops the source, the images and the formatting. Printing by hand from the browser works for one page and drags the ads, the cookie banner and the comment section along.
Printing to PDF from a real browser keeps the text selectable and the layout readable. Microlink renders the article with its print stylesheet, blocks ads and consent popups through adblock, lets you hide what remains with styles, and trims the document with pdf.pageRanges.
How to save a web article as PDF and store the file
A readable archive is a layout choice plus a retention choice. The layout comes from the request; the retention is your storage. The clean PDF recipe goes deeper on removing page chrome.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { url, size_pretty: size } = await microlink.pdf(
'https://example.com/blog/long-read',
{
format: 'A4',
margin: '1cm',
styles: ['header, footer, aside { display: none !important }']
}
)A4 with a one-centimeter margin and the chrome hidden reads well on screen and on paper. The response gives you the hosted url plus the file size.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
import { writeFile } from 'node:fs/promises'
const { url } = await microlink.pdf('https://example.com/blog/long-read')
const response = await fetch(url)
await writeFile('archive/long-read.pdf', Buffer.from(await response.arrayBuffer()))The hosted URL is for delivery, not for retention. Copy the file into storage you control, such as a bucket or a document store, under the retention policy your archive needs.
curl 'https://api.microlink.io/?url=https%3A%2F%2Fexample.com%2Fblog%2Flong-read&pdf.format=A4&pdf.margin=1cm&pdf.pageRanges=1-10&meta=false'pageRanges trims the comment sections and footers that run past the article. A range that falls outside the document fails with EPAGERANGE, so size it to the article instead of guessing high.
- pdf.format A4 (the default) or Letter for archives that may be printed.
- pdf.margin Whitespace around the text. Default 0.35cm; 1cm is a comfortable reading margin.
- pdf.pageRanges Keeps only the pages that contain the article, for example 1-10.
- styles Hides navigation, sidebars, comments and related-post widgets with injected CSS.
- mediaType print by default for PDFs; screen when the print stylesheet drops images you want to keep.
- ttl Keeps the response cached from 1 minute to 31 days while your job copies the file. Pro plans.
Leave meta at its default to get the page’s title, author, publisher and date in the same response; they make good filenames and index entries for the archive.
Why PDF is the right format to archive web pages
The archive has to be readable in ten years and findable next week. A PDF printed from a real browser render gives you both.
For the raw content instead of a document, the Markdown API returns the same article as text you can index directly, and clean Markdown from any URL shows how to scope it to the article body.
When a site’s print stylesheet is missing or too aggressive, switch mediaType to screen and trim with styles instead.
When not to: pages that require a login or sit behind bot protection need the headers or proxy parameters first, both on Pro plans. Paywalled content you are not licensed to keep should not be archived at all.
FAQ
Is the text in an archived PDF searchable?
How do I keep an archived PDF permanently?
How do I remove comments and related posts from the article PDF?
Can I archive pages behind a login or a paywall as PDF?
Can I save the title, author and date together with the PDF?
Solve the next problem with the same API
Clean PDFs without ads or banners
Paper size, margins and orientation
PDFs in bulk
PDF download links and previews
Clean Markdown, no boilerplate
Markdown with metadata frontmatter
Ready to archive the web as PDF?
Readable, searchable documents from any article, printed the way the publisher intended. Start on the free tier and build your first archive job today.