Changing an Image Used in PSPDFKit

The easiest way to change an image used in PSPDFKit would be to open up the PSPDFKit.bundle and replace files there, but it’s not the recommended way, and it’s hard to make sure you update this for each and every update we release.

The better way is to register a custom handler on the PSPDFKitGlobal object via imageLoadingHandler. This takes a block, gives you the image name, and allows you to return a custom image. If you return nothing, the default PSPDFKit image will be used. It’s best to set this block in the app delegate or before any UIViewController is on the screen. Images are cached, so a change made after caching will not do anything.

Asset Catalog

PSPDFKit 7 for iOS added vector images and support for asset catalogs. These images are located in PSDPDFKitUI.framework/Assets.car from PSDPDFKitUI.xcframework. You can use a tool like Asset Catalog Tinkerer to browse the asset catalog.