Please Export BackgroundWorker (or Provide Access to the Underlying Isolate) for Advanced PDFium Integrations
Summary
The BackgroundWorker class inside pdfrx_engine is currently not exported, which prevents applications from accessing the isolate where PDFium executes. This makes it impossible to perform custom PDFium operations that must run inside the same isolate, especially because PDFium is not thread-safe.
Problem
I need to run additional native PDFium functions (via FFI) that pdfrx does not expose yet.
However:
- PDFium is not thread-safe, so these operations must run inside the same isolate the engine uses.
- The isolate is encapsulated inside a non-exported class:
BackgroundWorker. - Because this class is private to the package, external code cannot:
- Schedule compute tasks on the PDFium isolate
- Perform custom FFI operations safely
- Extend functionality without duplicating or breaking internal behavior
This makes it impossible to implement advanced PDF features without modifying the package.
Requested Change
Please export the BackgroundWorker class (or provide a safe public API to schedule tasks on the PDFium isolate), so developers can:
- Access the isolate the engine uses internally
- Schedule custom operations with
compute() - Run additional PDFium-based tools safely
- Avoid thread-safety issues caused by running FFI calls on arbitrary isolates
Even exposing only the compute interface would be sufficient.
Why This Matters
Many advanced PDF operations require calling native PDFium functions directly.
Providing access to the isolate would enable:
- Custom rendering or image processing
- Working with PDF structures not yet exposed by pdfrx
- Running PDFium tools or utilities inside the same isolate
- Implementing batch operations and analysis without risking unsafe threading
This would greatly extend the usefulness of pdfrx without breaking existing APIs.
Possible Solutions
Any of the following would work:
- Export
BackgroundWorkerdirectly - Expose a public getter such as:
Pdfrx.engineWorker.compute(...)