◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/App Dev
◇ App Dev/2026-07-03Intermediate

Adding PDF Viewing and Export to a Rork Max App — When to Use PDFKit vs. ImageRenderer

Implement PDF viewing, search, and export in Rork Max's native Swift with PDFKit. Covers UIGraphicsPDFRenderer vs. ImageRenderer trade-offs, password protection, and share sheet integration.

rork-max40pdfkitswift8imagerendererpdf-export

✦ Premium Article

Running an app with a notes feature, I started receiving the same request over and over: "Can I send my notes as a PDF?" As an indie developer, I initially assumed piping plain text into the share sheet was enough. But for people using the app to keep work records, a properly formatted PDF isn't a nicer version of text — it's a deliverable, and text doesn't substitute for it.

Because Rork Max generates native Swift, you get PDFKit — which ships with the OS — for free. Viewing, search, and export all work without adding a single dependency, and that's the biggest practical difference from a React Native setup. In this article I'll walk through working code for viewing, exporting, password protection, and sharing.

Why Handle PDFs in Rork Max (Native Swift)?

With React Native Rork, your options are third-party libraries or WebView rendering for display, and HTML-bridge approaches like expo-print for generation. They work, but I kept running into limits around dependency maintenance and fine-grained layout control.

ApproachViewingSearch / AnnotationGenerationExtra Dependency
WebView (RN)△ basic display only✕✕No
react-native-pdf etc. (RN)◯△ depends on library✕Yes
expo-print (RN)✕✕△ via HTMLYes
PDFKit (Rork Max / native)◯◯◯ with UIGraphicsPDFRendererNo (bundled with OS)

For a solo developer, not adding dependencies is itself a maintenance win. Being able to lean on the OS-standard framework for everything PDF-related is one of the concrete payoffs of choosing native generation.

A practical Rork Max prompt to start from looks like this:

Add a screen where saved notes can be viewed and exported as PDF.
Use PDFKit's PDFView for display and UIGraphicsPDFRenderer for export,
and make the result shareable via the share sheet.

With the generated code as a base, let's go through each building block and where you'll want to intervene.

Displaying with PDFView — a Minimal SwiftUI Wrapper

The heart of PDFKit is PDFView. It's a UIKit view, so you wrap it in UIViewRepresentable:

import SwiftUI
import PDFKit
 
struct PDFViewer: UIViewRepresentable {
    let url: URL
 
    func makeUIView(context: Context) -> PDFView {
        let view = PDFView()
        view.autoScales = true                 // fit to screen width
        view.displayMode = .singlePageContinuous
        view.usePageViewController(true)       // page-swipe feel
        view.document = PDFDocument(url: url)
        return view
    }
 
    func updateUIView(_ uiView: PDFView, context: Context) {
        if uiView.document?.documentURL != url {
            uiView.document = PDFDocument(url: url)
        }
    }
}

The first thing that trips people up is autoScales. Forget it and the PDF renders at its natural size — a tiny speck in the corner of the screen. Generated code sometimes omits it, so if your PDF looks minuscule, check this first.

PDFDocument(url:) lazy-loads pages, so even a several-hundred-page document opens quickly. Reading the whole file into Data and using PDFDocument(data:), on the other hand, spikes memory on large files. For local files, I recommend the URL initializer.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A minimal SwiftUI wrapper for PDFView, plus the autoScales setup detail that trips people up first
✦Clear criteria for choosing between UIGraphicsPDFRenderer and ImageRenderer (pagination, resolution, implementation cost)
✦Password-protected export and share sheet integration, with the production pitfalls I actually hit
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

◇ App Dev2026-10-15
My Ads Never Came Back After a Subscription Expired: Fixing the Direction of an Ad-Free Check
An ad-free flag stayed on after the subscription expired because the check pointed the wrong way. Here is how I rebuilt it to wait for two purchase queries, decide only from confirmed facts, and keep the last value on failure.
◇ App Dev2026-10-15
When adjustsFontSizeToFit Shrinks Just One Row, Suspect the Box Height, Not the String
Only the 10th row of a list drops to 4pt on iOS, though the data and strings are fine. I read the Yoga rounding and font-fit sources, then counted how often the box comes up short in Node.
◇ App Dev2026-10-15
When Only EAS Build Fails with "No matching variant", Check Your Local android/build First
Gradle passes on your machine, but the Android build on EAS stops at "No matching variant of project". Reading the reports on GitHub, I traced how a Windows-generated autolinking cache can reach the Linux builder, and wrote a small script that checks for it before you queue a build.