◉RORK LABJP
●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens●SUBDOMAIN — Rork can now connect your web app to a subdomain only, leaving your root domain and www untouched (12/1)●UPDATES — expo-updates 58.0.23 fixes Android release builds embedding a stale runtime version●FLASH END — Intro pricing for Gemini Flash models ends 12/31, 29 days from now. Time to recheck AI feature costs●HMR — Some report the dev server picking up another server's bundle and then exiting●FIRST VIEW — Map the first screen for a normal launch, a notification, and a link, and back navigation stops surprising you●CARBON — Gemini 4 Carbon and Argon are now at standard rates: $4.00 input, $20.00 output per 1M tokens
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-11-24
Why Only the First Page of Your Carousel Is Blank at Launch, and How to Make FlatList Start on the Right Page
My wallpaper app opened on an empty first page. Swiping showed page two just fine, and swiping back left page one empty again. The pager had been told where to start before it knew its own size. Here is the Android fix and the Expo FlatList pattern that closes the same gap.
◇ App Dev2026-11-16
I Set cameraPermission to false for a Photo Picker, and the QR Scanner Lost Its Camera Too
In expo-image-picker, cameraPermission: false deletes NSCameraUsageDescription from Info.plist on iOS and blocks CAMERA for every package on Android. Here is what happens when you also use expo-camera, and a working script that checks permissions before you submit.
◇ App Dev2026-11-12
For the Day a Crash You Fixed Refuses to Go Away: Give Every Fix a Flag That Says It Is Active
A fix that worked in debug was silently disabled in release by code shrinking. Record whether each fix is active as a crash-report key and a log line, and confirm it on release day in an Expo Android app.