Recommended Free Tools
In a macOS app, load the page in a WKWebView and call pdf(configuration:) to get PDF data asynchronously. Use createPDF(configuration:completionHandler:) for a completion-handler workflow, or printOperation(with:) when you want WebKit’s AppKit print operation instead. The right route depends on whether your app needs PDF bytes or an interactive print flow.
Choose the WebKit PDF or print API
| Goal | API | What it provides |
|---|---|---|
| Get PDF data from the web view | pdf(configuration:) |
An asynchronous PDF-data result; WKPDFConfiguration specifies the portion of the view to capture. Apple API reference. |
| Use callback-based PDF generation | createPDF(configuration:completionHandler:) |
Asynchronous generation with PDF data or an error in the completion handler. Apple WKWebView documentation. |
| Print the web view | printOperation(with:) |
An NSPrintOperation for printing the view; the method may return nil if printing is unsupported. Apple API reference. |
WKWebView is Apple’s native view for interactive web content and supports loading remote requests, local files, and HTML strings. Apple says it replaces the older macOS WebView class on macOS 10.10 and later; confirm API availability against the SDK and deployment target you build with. Apple’s WKWebView overview.
As an Amazon Associate I earn from qualifying purchases.
Generate PDF data from a loaded page
First load the page you want to capture into a WKWebView. Then call pdf(configuration:) and handle the asynchronous result. The following is the core of the PDF step in an app that already has a configured web view and has completed loading its page:
import WebKit
func makePDF(from webView: WKWebView) async throws -> Data {
let configuration = WKPDFConfiguration()
return try await webView.pdf(configuration: configuration)
}
The result is PDF Data. Saving it to a file is a separate application step; choose the destination and file-handling behavior appropriate to your app. For example, after obtaining data, a file-oriented flow can write it with Foundation:
#1 Best Overall
- BUILT FOR COLLEGE. AND BEYOND — MacBook Air with the M5 chip packs blazing speed and powerful AI capabilities into an incredibly portable design. And with up to 18 hours of battery life,* this thin and light powerhouse is ready to take on almost any major, just about anywhere.
- TEAR THROUGH TOUGH ASSIGNMENTS — With its faster CPU and unified memory, the M5 chip delivers even more performance and fluidity across apps, making multitasking and creative workflows smooth and responsive. A powerful Neural Engine and next-generation GPU with Neural Accelerators give you a powerful platform for AI.
- MAKE QUICK WORK OF YOUR TO-DO LIST — Apple Intelligence helps you write, express yourself, and get things done effortlessly — whether it’s for school or everyday life. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
- UP TO 18 HOURS OF BATTERY LIFE — MacBook Air delivers incredible battery life with amazing performance, so you can power through a full day of classes without worrying about plugging in.
- A BRILLIANT 13.6-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Air supports 1 billion colors, making photos and videos pop with rich contrast and sharp detail, and text appears supercrisp. So everything — from class presentations to movies to games — looks truly stunning.
let data = try await makePDF(from: webView)
try data.write(to: destinationURL)
The configuration controls which portion of the web view is captured. Do not assume that this alone defines a particular paper size, margin, or pagination policy: those details need validation for your target SDK and content.
Use the completion-handler API when it fits your app
If your codebase uses callbacks rather than async/await, use createPDF(configuration:completionHandler:). The completion handler receives either PDF data or an error, so handle both outcomes rather than treating generation as guaranteed:
let configuration = WKPDFConfiguration()
webView.createPDF(configuration: configuration) { result in
switch result {
case .success(let data):
// Save or process the PDF data here.
break
case .failure(let error):
// Report or recover from the generation error.
print("PDF generation failed: (error)")
}
}
Check the signature available in the SDK you target, since exact API availability depends on the build configuration.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- This Certified Refurbished product is tested and certified to look and work like new. The refurbishing process includes functionality testing, basic cleaning, inspection, and repackaging. The product ships with all relevant accessories, a minimum 90-day warranty, and may arrive in a generic box. Only select sellers who maintain a high performance bar may offer Certified Refurbished products on Amazon.com
- 2.6GHz quad-core Intel Core i7
- Turbo Boost up to 3.5GHz
- Four Thunderbolt 3 (USB-C) ports
- AMD Radeon Pro 450 GPU (2GB GDDR5)
Use WebKit’s print operation for a print flow
When the user should enter an AppKit printing workflow, call printOperation(with:) rather than treating printing as a PDF-data export. The method can return nil when printing is unsupported, so account for that case before presenting or running the operation:
if let operation = webView.printOperation(with: NSPrintInfo.shared) {
operation.run()
} else {
// Printing is unsupported for this web view.
}
Use the PDF-data APIs when your app needs the generated bytes for saving or further processing. Use the print operation when the intended result is the web view’s print workflow.
Validate layout against real pages
WebKit documents the capture APIs, but the documentation consulted does not establish identical pagination, margins, paper sizing, or rendering behavior across every macOS release. Test representative content in the macOS versions and SDKs your app supports.
Rank #3
- 1.4 GHz Intel Core i5 Quad-Core (8th Gen)
- 8GB LPDDR3 RAM | 128GB PCIe SSD
- 13.3" 2560 x 1600 Retina Display
- Integrated Intel Iris Plus Graphics 645
- Touch Bar | Touch ID Sensor
- Check long pages and page breaks, including how important content falls across page boundaries.
- Test pages with dynamic content and images that may not have loaded when capture begins.
- Inspect pages that use print-specific CSS, as well as pages whose screen layout differs from their printed layout.
- Verify the captured portion of the web view matches the intended output.
- Test both successful generation and error handling in the actual app flow.
Troubleshoot common failures
The returned PDF is incomplete or has unexpected layout
Check that the desired page has finished loading and that dynamic content and images are ready before requesting the PDF. Review the configured capture portion, then test the page’s print styles and breaks on the target macOS release. Apple’s API documentation does not promise identical layout for every page or version.
PDF generation fails
Handle the thrown error from pdf(configuration:) or the failure case from createPDF(configuration:completionHandler:). Confirm the web view has the intended loaded content and surface a recoverable error rather than assuming a PDF was created.
The print operation is unavailable
printOperation(with:) may return nil when printing is unsupported. Branch on the optional result and provide an appropriate fallback, such as an explanatory message or a PDF-data flow if that fits the app.
Rank #4
- BUILT FOR COLLEGE. AND BEYOND — MacBook Air with the M5 chip packs blazing speed and powerful AI capabilities into an incredibly portable design. And with up to 18 hours of battery life,* this thin and light powerhouse is ready to take on almost any major, just about anywhere.
- TEAR THROUGH TOUGH ASSIGNMENTS — With its faster CPU and unified memory, the M5 chip delivers even more performance and fluidity across apps, making multitasking and creative workflows smooth and responsive. A powerful Neural Engine and next-generation GPU with Neural Accelerators give you a powerful platform for AI.
- MAKE QUICK WORK OF YOUR TO-DO LIST — Apple Intelligence helps you write, express yourself, and get things done effortlessly — whether it’s for school or everyday life. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
- UP TO 18 HOURS OF BATTERY LIFE — MacBook Air delivers incredible battery life with amazing performance, so you can power through a full day of classes without worrying about plugging in.
- A BRILLIANT 13.6-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Air supports 1 billion colors, making photos and videos pop with rich contrast and sharp detail, and text appears supercrisp. So everything — from class presentations to movies to games — looks truly stunning.
The API is unavailable in the build
Check the target SDK, deployment target, and API availability for the macOS versions your app supports. Apple’s overview notes that WKWebView replaces WebView on macOS 10.10 and later, but the selected API’s exact availability must be checked in the SDK you use.
Or skip the browser setup
If you need a screenshot or PDF without building and managing a WebKit capture flow, ScreenshotNeo is a website screenshot API and MCP server. A single GET request can return an image or PDF; its API accepts a URL and offers capture options, while its MCP server provides tools for AI clients.
Free tools Windows power users keep installed
One-click scans. No signup required.
For example, save a page as PDF with cURL (see the ScreenshotNeo API documentation for request options):
Best Value
- AN AMAZING MAC AT A SURPRISING PRICE — With an incredibly portable and durable aluminum design, up to 16 hours of battery life,* and the A18 Pro chip, MacBook Neo is ready to go wherever school takes you.
- FOUR STUNNING COLORS. ONE DURABLE DESIGN — Choose from four beautiful colors — Silver, Blush, Citrus, or Indigo — each with a color-coordinated keyboard. And MacBook Neo is made with a durable recycled aluminum enclosure that helps it reach 60 percent recycled content by weight — the most ever in any Apple product.*
- FLY THROUGH EVERYDAY ASSIGNMENTS — Whether you’re cramming for finals, using Apple Intelligence* to summarize class notes, creating presentations, or even playing the latest Apple Arcade game,* MacBook Neo delivers the performance and AI capabilities you need to get things done.
- UP TO 16 HOURS OF BATTERY LIFE — MacBook Neo delivers all day battery life, so you can power through from early morning classes to late night study sessions without worrying about plugging in.
- A VIBRANT 13-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Neo supports 1 billion colors, so photos and videos pop and text is crisp for easy reading.
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.com
-d format=pdf
-o page.pdf
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free.
Frequently Asked Questions
Can I get PDF bytes directly from WKWebView?
Yes. The async `pdf(configuration:)` API returns PDF data, and `createPDF(configuration:completionHandler:)` offers a completion-handler form.
Does WKPDFConfiguration set page size and margins?
The cited API documentation establishes that it specifies the portion of the view to capture; it does not establish a universal page-size or margin behavior. Validate your output for the SDK and content you target.
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.




