Skip to content

pdfrx Initialization

Takashi Kawasaki edited this page Aug 28, 2025 · 8 revisions

If you use Flutter widgets like PdfViewer or PdfDocumentViewBuilder, they implicitly initialize the library by calling pdfrxFlutterInitialize.

But if you use PdfDocument directly, you should explicitly do either one of the following ways:

The first one is the recommended and the easiest way to initialize Flutter app.

For pure Dart apps (or even some of Flutter apps), you can use pdfrxInitialize.

Initialize Things By Yourself

Basically, these initialization functions do the following things:

Cache Directory

The mechanism to locate cache directory is different between pure Dart apps and Flutter apps:

Init. Func. Underlying API Notes
pdfrxInitialize Directory.systemTemp May not be suitable for mobile apps.
pdfrxFlutterInitialize path_provider.getTemporaryDirectory Always app local directory.

Download PDFium Binary On-Demand

For pure Dart apps, because it is typically used on desktop environments, pdfrx downloads PDFium binary if your environment does not have it.

Clone this wiki locally