native_pdf_renderer
5.0.0+1, released 5 years ago by serge.software
Flutter plugin to render PDF pages as images on Web, MacOS, Windows, Android and iOS.
What it does
Allows opening PDF documents from assets, files, or raw data, and rendering individual pages into image bytes. It supports multiple platforms including Web, macOS, Windows, Android, and iOS.
AI-written summary of version 5.0.0+1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display PDF page previews or render PDF pages as images in a Flutter app.
- You need cross-platform PDF rendering supporting mobile, desktop, and web.
Skip it when
- You want the newer renamed package pdfx instead.
- You need complex interactive PDF viewing features out-of-the-box without manual image rendering.
Strengths
- Supports a wide range of platforms: Android, iOS, macOS, Windows, and Web.
- Allows opening documents from assets, files, and bytes.
- Provides control over rendering resolution, background color, and image format.
Weaknesses
- Plugin has been renamed and republished as `pdfx`.
- Requires platform-specific setup on Web (PDF.js script tags) and Windows (PDFium version overrides).
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 1
Requires adding script tags to index.html for Web and optionally overriding PDFium version in CMakeLists.txt for Windows.
import 'package:flutter/material.dart';
import 'package:native_pdf_renderer/native_pdf_renderer.dart';
void main() async {
final document = await PdfDocument.openAsset('assets/sample.pdf');
final page = await document.getPage(1);
final pageImage = await page.render(width: page.width, height: page.height);
await page.close();
await document.close();
}Alternatives
Packages that do the same job and could replace native_pdf_renderer.
- pdf_combiner
Merge multiple PDF documents and images into a single file or extract images from PDFs.
85Compare - dart_pdf_editor
Flutter PDF editor and viewer with native rendering and editing tools
83Compare - pdf_manipulator
Cross-platform PDF toolkit for Flutter. Merge, split, render, extract, search, sign, encrypt, convert, build from scratch. Rust engine, off the main thread.
83Compare - flutter_to_pdf
Export any Flutter widget to a PDF document, page, or widget natively in Dart.
60Compare
Works with
Packages commonly used together with native_pdf_renderer: ones it builds on, ones built on it, and its own family.