Customizing iOS PDF Viewer Icons

You can replace image resources used by PSPDFKit by registering a custom handler on the SDK object as its imageLoadingHandler. This handler is a closure that gives you the image name and allows you to return a custom image. If you return nil, the default PSPDFKit image will be used. It’s best to set this closure in the app delegate or before any UIViewController is on the screen. Images are cached, so a change made after caching won’t do anything:

SDK.shared.imageLoadingHandler = { imageName in
    if imageName == "knob" {
        return UIGraphicsImageRenderer(size: CGSize(width: 20, height: 20)).image { context in
            UIBezierPath(rect: context.format.bounds).fill()
        }
    } else if imageName == "document" {
        return UIImage(named: "customDocumentImage")
    }
    return nil
}

Asset Catalog

PSPDFKit uses vector images in asset catalogs. These images can be found in PSPDFKit.framework/Assets.car (which is located in PSPDFKit.xcframework) and PSPDFKitUI.framework/Assets.car (which is located in PSDPDFKitUI.xcframework). You can use a tool like Asset Catalog Tinkerer to browse the asset catalog.