dart_pdf_reader
2.2.0, released 9 months ago by chimerapps.com
Pure‑dart PDF parser that reads PDF structures from a byte stream.
What it does
It parses PDF files into a document object model, exposing catalogs, pages, outlines and other PDF objects. It works on all supported platforms, including web, by using a byte stream abstraction.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read PDF metadata or extract pages without rendering the PDF.
- You want a lightweight, pure‑dart solution that works on web and mobile.
- You need to process PDFs in a serverless or CLI environment without native dependencies.
Skip it when
- You need to render PDFs to the screen or display them in a widget.
- You require advanced PDF manipulation like editing or signing.
- You need a full PDF viewer with UI components.
Strengths
- Pure Dart, no native dependencies; works on web, mobile, desktop.
- Supports badly formatted PDFs and compressed cross‑reference tables.
- Provides a clear API for accessing catalog, pages, outlines, and page objects.
- Good test coverage and CI integration.
Weaknesses
- No rendering or UI support; only parsing.
- Limited to reading; no editing or annotation features.
- Performance may be slower for very large PDFs compared to native libraries.
- Requires manual handling of file streams on each platform.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Add dependency in pubspec and import 'dart_pdf_reader.dart'. No special permissions needed.
final stream = ByteStream(File(inputFile).readAsBytesSync());
final doc = await PDFParser(stream).parse();
final pages = await (await doc.catalog).getPages();Alternatives
Packages that do the same job and could replace dart_pdf_reader.
- package_config
Read and write Dart package configuration files.
80Compare - pubspec_parse
Parse pubspec.yaml files with a type‑safe API and detailed error reporting.
93Compare - config
Typed CLI argument and config file parser with env support
84Compare - args
Library for parsing raw command-line arguments into options and values using GNU and POSIX styles.
82Compare
Works with
Packages commonly used together with dart_pdf_reader: ones it builds on, ones built on it, and its own family.
- archivedart_pdf_reader depends on itEncodes and decodes archive and compression formats such as zip, tar, gzip, and zlib.
- charsetdart_pdf_reader depends on itCharset encoding and decoding library for various text encodings in Dart.
- dart_service_announcementSame familyHelper libraries for creating discoverable development services.