dart_pdf_engine_viewer library

dart_pdf_engine viewer — Flutter widgets for displaying PDF documents.

Import this library to use the PdfViewer widget and related components for directly previewing PDFs in your Flutter app.

This re-exports the core library, so you only need one import:

import 'package:dart_pdf_engine/dart_pdf_engine_viewer.dart';

Quick Start

Preview a programmatically created PDF:

final doc = PdfDocument();
doc.pages.add().graphics.drawString(
  'Hello World!',
  PdfStandardFont(PdfFontFamily.helvetica, 20),
  brush: PdfSolidBrush(PdfColor.black),
  bounds: Rect.fromLTWH(50, 50, 200, 30),
);

PdfViewer(
  controller: PdfViewerController.fromDocument(doc),
)

Preview a PDF from base64:

PdfViewer(
  controller: PdfViewerController.fromBase64(base64PdfString),
)

Classes

FontMetrics
Font metrics for the 14 standard PDF fonts.
ParsedBookmark
Parsed representation of a bookmark.
ParsedPage
Parsed representation of a PDF page.
PdfAnnotation
Base class for PDF annotations.
PdfArray
PDF Array.
PdfBitmap
Represents a bitmap image (JPEG or PNG) for embedding in PDF.
PdfBookmark
Represents a bookmark (outline) entry in the PDF document.
PdfBookmarkCollection
Collection of bookmarks in the document.
PdfBoolean
PDF Boolean value.
PdfBrush
Abstract brush for filling shapes and text.
PdfColor
Represents a color in PDF (RGB, 0-255 per channel).
PdfDictionary
PDF Dictionary.
PdfDocument
The main entry point for creating PDF documents.
PdfDocumentInfo
Document metadata.
PdfFont
Abstract base class for all PDF fonts.
PdfGraphics
Canvas-like graphics API for drawing on a PDF page.
PdfGrid
A table (grid) element that can be drawn on a PDF page.
PdfGridCell
A single cell.
PdfGridCellStyle
Cell style.
PdfGridColumn
A single column.
PdfGridColumnCollection
Column collection.
PdfGridHeaderCollection
Header row collection.
PdfGridRow
A single row in the grid.
PdfGridRowCollection
Row collection.
PdfGridRowStyle
Row style.
PdfGridStyle
Grid style configuration.
PdfIndirectObject
PDF indirect object — wraps any PdfObject with an object number.
PdfMargins
Page margins in points.
PdfName
PDF Name object (e.g., /Type, /Page).
PdfNull
PDF Null value.
PdfNumber
PDF numeric value (int or double).
PdfObject
Base class for all PDF objects.
PdfOrderedList
An ordered (numbered) list element.
PdfPage
Represents a single page in a PDF document.
PdfPageCollection
Collection of pages in a document.
PdfPageRenderer
Renders a single PDF page's content stream to a Flutter Canvas.
PdfPageSettings
Page settings: size, orientation, margins.
PdfPageSize
Standard page sizes in points.
PdfPageView
Widget that renders a single PDF page.
PdfParser
High-level PDF parser.
PdfPath
Represents a Bezier path for drawing complex shapes.
PdfPen
Pen for stroking shapes and lines.
PdfReference
PDF indirect object reference (e.g., "5 0 R").
PdfSolidBrush
Solid color brush.
PdfStandardFont
A standard PDF font (one of the 14 built-in fonts). These fonts do not need to be embedded in the PDF.
PdfStream
A PDF stream object — dictionary + binary data.
PdfString
PDF String (literal or hexadecimal).
PdfStringFormat
String format options for text drawing.
PdfToken
A single token from the PDF byte stream.
PdfTokenizer
Low-level lexer for PDF byte streams.
PdfTrueTypeFont
A TrueType font that can be embedded in the PDF. Supports Unicode text rendering.
PdfUnorderedList
An unordered (bulleted) list element.
PdfUriAnnotation
A URI annotation that creates a clickable hyperlink on the page.
PdfViewer
A complete PDF viewer widget with page navigation and zoom support.
PdfViewerController
Controller for loading and managing PDF documents in the viewer.
Rect
Simple rectangle class (to avoid Flutter dependency).
StandardFontMetrics
Pre-built metrics for the 14 standard PDF fonts. These use the standard AFM (Adobe Font Metrics) values.

Enums

PdfDashStyle
Dash style for pen strokes.
PdfFontFamily
The 14 standard PDF font families.
PdfPageOrientation
Page orientation.
PdfTextAlignment
Text alignment options.
PdfTokenType
Token types produced by the PDF tokenizer.