pdfkit

Display and manipulate PDF documents in Swift using PDFKit components.

Updated May 6, 2026
One-click install
npx skills add https://github.com/Roy-wonji/claude-config --skill pdfkit-roy-wonji
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pdfkit
Source: https://github.com/Roy-wonji/claude-config/tree/main/skills/swift-ios-skills/skills/pdfkit
Command: npx skills add https://github.com/Roy-wonji/claude-config --skill pdfkit-roy-wonji

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill removes guesswork when building iOS apps that need to display, navigate, search, and modify PDF files using PDFKit, so you can implement PDF functionality correctly and reliably.

Core Features & Use Cases

  • Display & Navigation: Render PDFs with PDFView, jump to pages, and integrate browsing/selection flows.
  • Document Loading & Editing: Create PDFDocument instances from URLs/Data, handle password-protected PDFs, insert/remove/exchange pages, and write updated documents.
  • Search, Extract, and Highlight Text: Find strings (sync/async patterns), extract document/page/region text via PDFSelection, and apply highlighted selections.
  • Annotations & Thumbnails: Add common annotation types (highlights, notes, links, widgets) and generate/display thumbnails efficiently.
  • SwiftUI Integration: Wrap PDFView for SwiftUI using UIViewRepresentable, including practical update rules for reference identity.

Quick Start

Use the pdfkit skill to implement a SwiftUI screen that loads a local PDF file, displays it with PDFView, enables page navigation and text search, and adds a highlighted annotation based on a search term.

Frequently Asked Questions about pdfkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I display a PDF in SwiftUI using PDFKit?

Display a PDF in SwiftUI by wrapping PDFView with UIViewRepresentable, ensuring proper reference identity checks using !== during state updates to avoid unnecessary reloads.

How do I search for text and highlight it in a PDFDocument?

Search for text in a PDFDocument using PDFSelection to find strings synchronously or asynchronously, then apply highlighted selections to visually mark the matched text within the document.

How do I handle password-protected or locked PDF files in Swift?

Handle locked PDF files by initializing a failable PDFDocument with the correct password, guarding the creation to prevent crashes, and performing mutations on the main thread.

Why are my PDF annotations appearing in the wrong position?

PDF annotations appear in the wrong position due to incorrect coordinate handling; PDFKit uses a flipped coordinate system, so you must properly convert coordinates when placing annotations.

Can I generate thumbnails for PDF pages using PDFKit?

Generate thumbnails for PDF pages using PDFKit by efficiently rendering page images, suitable for displaying browsing grids or navigation previews within your iOS app.

What is the best way to navigate and modify PDF pages in Swift?

Navigate and modify PDF pages by loading a PDFDocument, using page history for navigation, and calling insert, remove, or exchange methods to update the document structure before writing.