Skip to content
Blog

PDF Viewing in Flutter: Choosing a Viewer, Renderer, or Printer

Compare flutter_pdfview, syncfusion_flutter_pdfviewer, pdfx and printing to render PDFs on mobile and web with navigation, zoom and passwords.

Published on • November 10, 2026

AI Assistant

Flutter apps routinely need to show a contract, an invoice, or a report, but no single package covers every platform with the same features. This post compares the main pub.dev options - flutter_pdfview, syncfusion_flutter_pdfviewer, pdfx, and the printing package - and shows how to render local and network files, navigate pages, handle passwords, and keep memory under control.

Picking the right PDF package

Platform coverage and licensing decide most of the choice before you write a line of code:

dependencies:
  flutter_pdfview: ^1.4.5                  # native viewer, Android + iOS only
  syncfusion_flutter_pdfviewer: ^35.1.43   # commercial or Community license
  pdfx: ^2.11.0                            # renderer + viewer, five platforms
  printing: ^5.15.1                        # print, share, raster, PdfPreview

flutter_pdfview wraps the native viewers: barteksc’s AndroidPdfViewer on Android and Apple’s PDFKit on iOS (iOS 12+), so it feels fastest but ships no web or desktop support - its README lists macOS, Windows, Linux, and Web as future plans. syncfusion_flutter_pdfviewer covers Android, iOS, web, Windows, Linux, and macOS with virtual scrolling, text search, bookmarks, and form filling, but it is a commercial package requiring a Syncfusion license or their free Community license. pdfx splits into a renderer API (open a document, render pages to images) and a viewer API (PdfView / PdfViewPinch) across Android, iOS, macOS, web, and Windows. If you need a PDFium-based viewer with editing features, pdfrx is a maintained alternative on all six platforms.

Rendering local and network PDFs

Each package loads documents differently. flutter_pdfview takes a file path or raw bytes:

PDFView(
  filePath: savedPath,
  password: passwordOrNull,
  fitPolicy: FitPolicy.WIDTH,
  onRender: (pages) => setState(() => pageCount = pages),
  onError: (error) => debugPrint('$error'),
  onViewCreated: (controller) => _controller = controller,
),

pdfx reads from assets, files, or data, and the docs recommend internet_file for network documents:

import 'package:internet_file/internet_file.dart';
import 'package:pdfx/pdfx.dart';

final bytes = await InternetFile.get(url); // works on all platforms
final doc = await PdfDocument.openData(bytes);
// PdfDocument.openAsset('assets/sample.pdf') or openFile(path) also work

Syncfusion exposes one constructor per source, so network PDFs need no download step at all:

SfPdfViewer.network(
  'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
);
// SfPdfViewer.asset('assets/doc.pdf'), .file(file), .memory(bytes)

Both viewer packages expose imperative controllers. flutter_pdfview reports state through futures:

final pages = await _controller.getPageCount();
await _controller.setPage(pages - 1);        // jump to last page
final zoom = await _controller.getScale();
await _controller.setScale(zoom * 1.5);       // zoom in
await _controller.setZoomLimits(1.0, 2.0, 4.0); // min, mid, max

pdfx uses a scroll-controller style API, with PdfViewPinch re-rendering on zoom so quality survives pinch gestures (that re-render is not supported on Windows):

pdfController.jumpToPage(3);
await pdfController.nextPage(
  duration: const Duration(milliseconds: 250),
  curve: Curves.easeIn,
);

For encrypted files, check the API before committing: flutter_pdfview exposes a password property on both platforms, and SfPdfViewer.network(url, password: '...') loads password-protected documents, while pdfx’s documented API is built around openAsset/openFile/openData with no password parameter. One classic mobile gotcha: inside a SingleChildScrollView or PageView the parent can steal drag gestures, so flutter_pdfview needs gestureRecognizers: {Factory<OneSequenceGestureRecognizer>(() => EagerGestureRecognizer())} for swiping to work, especially on iOS.

Web and desktop differences

Web builds need JavaScript, not plugins. pdfx ships a helper that injects the PDF.js library into web/index.html:

dart run pdfx:install_web      # adds the PDF.js CDN script
dart run pdfx:install_windows  # pins the pdfium version in CMakeLists.txt

Syncfusion requires the same idea by hand: add PDF.js script tags to web/index.html (for PDF.js 4.x, a module import of pdf.min.mjs plus GlobalWorkerOptions.workerSrc, or the classic pdf.js/2.11.338/pdf.min.js pair for older versions). printing can also pin its Pdf.js version with a dartPdfJsVersion script before </head>. Desktop needs are smaller: macOS print support requires the com.apple.security.print entitlement, and iOS printing requires use_frameworks! in the Podfile. Note that on web, pdfx always produces PNG page images - the JPEG, background color, and crop rect render options are ignored.

Memory and large documents

A 500-page scan can exhaust memory fast if you render eagerly. The safe patterns from the docs: Syncfusion’s virtual scrolling renders only the pages currently needed; pdfx warns that Android requires closing a page before opening the next one (page.close(), otherwise the app may crash), and its renderer asks for width: page.width * 2, which doubles linear resolution and quadruples pixels per page - use JPEG for large pages, and remember web always returns PNG. For thumbnails, don’t open a viewer at all: Printing.raster rasterizes only the pages you ask for at any dpi:

await for (final page
    in Printing.raster(pdfBytes, pages: [0, 1], dpi: 72)) {
  final image = page.toImage(); // or page.toPng()
}

Treat PDFView.getScreenshot() (a PNG of the whole visible view) as an on-demand operation, not something to call per frame.

Viewer, renderer, or share and print

Decide by job, not by habit. To display an existing file, use a viewer: flutter_pdfview on mobile-only, syncfusion_flutter_pdfviewer or pdfx when you also need web/desktop. To generate PDFs, use the pdf package (the engine behind printing) - it builds documents, it does not parse existing ones. To output a document, printing does it all platforms:

await Printing.layoutPdf(onLayout: (format) => doc.save()); // system print
await Printing.sharePdf(bytes: bytes, filename: 'invoice.pdf');
PdfPreview(build: (format) => doc.save()); // embeddable widget, web too

A practical split: viewer widget for reading, pdfx renderer for custom thumbnails or search UI, printing for print dialogs, sharing, and raster export.

Takeaway: Choose flutter_pdfview for native mobile viewing, syncfusion_flutter_pdfviewer or pdfx when you need web and desktop reach, and printing for generation, print, share, and raster tasks - then keep large files lean by rendering only visible pages, closing pages promptly, and rasterizing thumbnails at low dpi.

Sources