Webarchive to PDF: How to Turn a Safari .webarchive File Into a PDF
How to make a PDF of a .webarchive in Safari on a Mac, how to get the page out without Safari, and how to convert a whole folder.

To convert a webarchive to PDF, open the .webarchive file in Safari on a Mac and choose File, then Export as PDF. That's free and takes a few seconds.
With no Mac, or with a folder full of them, a short script gets the page out of the file. That's covered further down, and we tested it.
What a .webarchive File Is
A Web Archive is the format Safari uses when you save a page with File, then Save As, and pick Web Archive. It packs the page's HTML together with its images, stylesheets and scripts into one file.
A PDF is the easier thing to send.
How to Convert Webarchive to PDF in Safari on a Mac
- Double-click the .webarchive file. It opens in Safari.
- Choose File, then Export as PDF.
- Pick a name and folder, then click Save.
If you need to set the paper size, use Print instead (next section).

Using Print to Control Paper Size and Margins
If you need A4 or Letter pages, use the print dialog instead.
- With the webarchive open in Safari, press Cmd+P.
- Set the paper size and orientation.
- Open the PDF menu in the dialog and choose Save as PDF.
- Name the file and click Save.
A Clean PDF With Safari Reader
For an article, Reader gives a cleaner page. Open the Page menu in the Smart Search field and choose Show Reader, then File, then Export as PDF. Apple says the button only appears if the page has an article Reader can show.
Converting a Webarchive to PDF Without a Mac
You don't need to open the file to use it. Get the page out with the script below, or try one of these first:
- Ask whoever sent it to export a PDF from Safari, or to send the page's web address.
- If the page is still online, make the PDF from its address with our Webpage to PDF tool.

We ran example.com through Webpage to PDF in October 2026 and got a one-page PDF of 64.9 KB in 1.9 seconds. It visits the page as a new visitor without your login, so pages behind a sign-in come out as the login screen.
A .webarchive itself isn't HTML, so renaming it won't work. A saved .aspx page is different, and our ASPX to PDF guide shows when renaming it to .html does the job.
Get the Page Out of a Webarchive Without Safari
A .webarchive is a property list file, and Python can read those with nothing extra installed. This script writes the main page to an HTML file and puts the pictures and stylesheets inside it. Apple doesn't publish the format, so the key names come from files we inspected.
1# webarchive2html.py: python webarchive2html.py page.webarchive page.html
2import base64, html as htmllib, plistlib, re, sys
3from urllib.parse import quote, urljoin
4
5with open(sys.argv[1], "rb") as f:
6 archive = plistlib.load(f)
7main = archive["WebMainResource"]
8html = main["WebResourceData"].decode(main.get("WebResourceTextEncodingName") or "utf-8")
9# The output is UTF-8, so a charset named in the page has to say that too.
10html = re.sub(r"""(<meta[^>]*charset\s*=\s*["']?)[\w.:-]+""", r"\1utf-8", html, count=1, flags=re.I)
11parts = {r["WebResourceURL"]: r for r in archive.get("WebSubresources", [])}
12
13def inline(m):
14 url = urljoin(main["WebResourceURL"], htmllib.unescape(m.group(3)))
15 r = parts.get(url) or parts.get(quote(url, safe="%:/?#&=+;,@!$'()*"))
16 if not r:
17 return m.group(0)
18 data = base64.b64encode(r["WebResourceData"]).decode()
19 return "%s=%sdata:%s;base64,%s%s" % (m.group(1), m.group(2), r["WebResourceMIMEType"], data, m.group(2))
20
21html = re.sub(r"""\b(src|href)=(["'])(.+?)\2""", inline, html)
22with open(sys.argv[2], "w", encoding="utf-8") as f:
23 f.write(html)Install Python from python.org on Windows and run it with py. On a Mac, run it with python3, or install Python from the same site if the command's missing. Then upload the HTML file to HTML to PDF.
We ran this on a Mac in November 2026, on one small test page saved by WebKit, the engine Safari uses. The PDF came out at one page, with its text, both pictures, its stylesheet and a clickable link. We also built archives in Latin-1, with a query string and an Ü in the picture names, and those kept their text and pictures too.
Pictures that only exist in a stylesheet, like backgrounds, or in a srcset, aren't handled by this script, and neither is anything the page loads with scripts.
Convert a Folder of Webarchives
Neither of the Mac commands we tried keeps the pictures, so loop the script instead. With textutil -convert html, both pictures became links to files that don't exist, and cupsfilter had no filter for HTML. A plain text copy did convert, with no pictures.
1for f in *.webarchive; do python3 webarchive2html.py "$f" "${f%.webarchive}.html"; doneHTML to PDF takes several files at once and returned our two as one ZIP with a PDF each.
After You Have the PDF
- Add the page to a report or other documents with Merge PDF.
- Long pages with big photos can make a heavy file, so shrink it with Compress PDF before you email it.
- Need the text to edit? PDF to Word gives you a document you can change.
- For anything private, add a password with Protect PDF.
Frequently Asked Questions about Webarchive to PDF
Can I open a .webarchive file on Windows?
You can get the page out with the Python script above, or ask for the page's address and convert that.
What's the difference between Export as PDF and Print in Safari?
Export as PDF saves the page in one step. Print lets you set the paper size and orientation first, then save with the PDF menu.
Can I convert many webarchive files at once?
Yes, with the script and loop above, then HTML to PDF. For a handful, opening each one in Safari and using Export as PDF is fine too.
Will links still work in the PDF?
The link in our test page stayed clickable through the script and HTML to PDF.


