pdfrx_engine
0.9.6, released today by espresso3389.jp
Pure Dart PDF rendering and manipulation API built on top of PDFium.
What it does
pdfrx_engine provides low-level PDF document APIs for viewing, editing, combining PDF documents, and importing images without any Flutter dependencies. It relies on PDFium bindings to support rendering pages to bitmaps, extracting text, handling links, and creating or modifying PDF files in pure Dart applications, CLI tools, or server-side environments.
AI-written summary of version 0.9.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building CLI tools or server applications that process PDFs in pure Dart
- You need PDF rendering and manipulation capabilities without Flutter UI dependencies
- Creating custom PDF processing pipelines or combining multiple PDF documents
Skip it when
- You are building a Flutter application and need high-level UI widgets like ready-to-use PDF viewers
- You prefer an all-in-one Flutter plugin with built-in UI, text selection, and zoom controls (use pdfrx instead)
Strengths
- Platform-agnostic and works in pure Dart environments without Flutter dependencies
- Built on top of PDFium for robust PDF rendering and manipulation
- Supports page combining, image-to-PDF conversion, text extraction, and link loading
Weaknesses
- Native builds require a C toolchain to compile a small bundled library for thread safety
- Does not include Flutter UI widgets or high-level viewer controls by itself
Setup
- Kind
- FFI (native library)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 12
Requires calling pdfrxInitialize() before using any PDF engine APIs. Native builds also require a C toolchain to compile the bundled library that prevents simultaneous PDFium access.
import 'dart:io';
import 'package:pdfrx_engine/pdfrx_engine.dart';
void main() async {
await pdfrxInitialize();
final document = await PdfDocument.openFile('test.pdf');
try {
if (document.pages.isEmpty) return;
final page = document.pages.first;
final pageImage = await page.render(
width: (page.width * 200 / 72).round(),
height: (page.height * 200 / 72).round(),
);
if (pageImage == null) return;
try {
final image = pageImage.createImageNF();
await File('output.png').writeAsBytes(img.encodePng(image));
} finally {
pageImage.dispose();
}
} finally {
await document.dispose();
}
}Alternatives
Packages that do the same job and could replace pdfrx_engine.
- syncfusion_flutter_pdfviewer
Flutter PDF Viewer library to display PDF documents seamlessly and efficiently.
86Compare - pdf_combiner
Merge multiple PDF documents and images into a single file or extract images from PDFs.
85Compare - syncfusion_flutter_pdf
Native Dart library for creating, reading, editing, and securing PDF files.
89Compare - dart_pdf_editor
Flutter PDF editor and viewer with native rendering and editing tools
83Compare
Works with
Packages commonly used together with pdfrx_engine: ones it builds on, ones built on it, and its own family.
- archivepdfrx_engine depends on itEncodes and decodes archive and compression formats such as zip, tar, gzip, and zlib.
- cryptopdfrx_engine depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- ffipdfrx_engine depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- vector_mathpdfrx_engine depends on itVector math library for 2D/3D/4D vectors, matrices, quaternions, and geometry.
- imagepdfrx_engine depends on itPure Dart library to load, manipulate, encode, and decode various image formats.
- rxdartpdfrx_engine depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.
- synchronizedpdfrx_engine depends on itLock mechanism to prevent concurrent access to asynchronous code.
- pdfium_dartpdfrx_engine depends on itDart FFI bindings for the PDFium library providing low-level C API access.