pdf_render_maintained 1.5.4 copy "pdf_render_maintained: ^1.5.4" to clipboard
pdf_render_maintained: ^1.5.4 copied to clipboard

A maintained fork of pdf_render plugin providing PDF rendering APIs and Flutter widgets for iOS, Android, macOS, and Web.

pdf_render_maintained #

pub package License: MIT

A maintained fork of the original pdf_render plugin that provides intermediate PDF rendering APIs and easy-to-use Flutter Widgets. This package is inspired by and based on the excellent work by espresso3389.

⚠️ Important Notice #

This package is a maintained fork of the original pdf_render package by espresso3389. The original package is no longer actively maintained, so this fork provides:

  • Active maintenance and bug fixes
  • Updated dependencies for modern Flutter versions
  • Compatibility with latest Flutter SDK (3.0+)
  • Same API - drop-in replacement for the original package
  • All platforms supported (iOS, Android, macOS, Web)
  • WASM compatibility improvements
  • Gradle 8.11.1 support for modern Android builds
  • Swift Package Manager support for macOS
  • Latest dependencies (collection ^1.19.1, vector_math ^2.2.0)

Original Package Attribution #

This package is based on the original work by espresso3389 and the pdf_render package. We are grateful for their excellent work and maintain this fork to keep the package alive for the Flutter community.

Original Repository: https://github.com/espresso3389/flutter_pdf_render
Original Package: https://pub.dev/packages/pdf_render
Original Author: espresso3389

Features #

  • 📱 Multi-platform support: iOS, Android, macOS, and Web
  • 🎨 Easy-to-use widgets: PdfViewer, PdfDocumentLoader, PdfPageView
  • High-performance rendering: Direct texture rendering for smooth performance
  • 🔧 Flexible APIs: Both widget-based and low-level rendering APIs
  • 📄 Multiple sources: Load from assets, files, or memory data
  • 🎯 Interactive viewing: Pinch-zoom, pan, and navigation controls
  • 🍎 Swift Package Manager: Full SPM support for macOS development
  • 🏗️ Modern Build Tools: Gradle 8.11.1, latest dependencies

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  pdf_render_maintained: ^1.5.3

Then run flutter pub get.

Platform-Specific Setup #

macOS Swift Package Manager Support

This package includes full Swift Package Manager (SPM) support for macOS development:

  • Package.swift: Complete SPM configuration
  • Automatic Integration: Flutter handles SPM integration automatically
  • No Additional Setup: Works out of the box with Flutter projects
  • Modern Tooling: Compatible with latest Xcode and Swift tools

Note: For most Flutter projects, no additional setup is required. Flutter's plugin system will automatically handle the SPM integration.

Android Setup

The package supports modern Android development with:

  • Gradle 8.11.1: Latest Gradle version support
  • Kotlin 2.1.0: Modern Kotlin support
  • API 36: Latest Android API support
  • Automatic Integration: No additional setup required

iOS Setup

Standard iOS development with:

  • Swift Support: Full Swift compatibility
  • iOS 10.0+: Wide device compatibility
  • Automatic Integration: No additional setup required

Web Setup #

For Web support, add the following script tags to your index.html before the main.dart.js script:

<!-- IMPORTANT: load pdfjs files -->
<script
  src="https://cdn.jsdelivr.net/npm/pdfjs-dist@3.4.120/build/pdf.min.js"
  type="text/javascript"
></script>
<script type="text/javascript">
  pdfjsLib.GlobalWorkerOptions.workerSrc =
    "https://cdn.jsdelivr.net/npm/pdfjs-dist@3.4.120/build/pdf.worker.min.js";
  pdfRenderOptions = {
    cMapUrl: "https://cdn.jsdelivr.net/npm/pdfjs-dist@3.4.120/cmaps/",
    cMapPacked: true,
  };
</script>

Quick Start #

Simple PDF Viewer #

import 'package:pdf_render_maintained/pdf_render_widgets.dart';

@override
Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
      appBar: AppBar(title: const Text('PDF Viewer')),
      body: PdfViewer.openAsset('assets/hello.pdf'),
    ),
  );
}

Advanced Usage with Controller #

import 'package:pdf_render_maintained/pdf_render_widgets.dart';

class MyPdfViewer extends StatefulWidget {
  @override
  _MyPdfViewerState createState() => _MyPdfViewerState();
}

class _MyPdfViewerState extends State<MyPdfViewer> {
  PdfViewerController? controller;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('PDF Viewer')),
      body: PdfViewer.openAsset(
        'assets/hello.pdf',
        params: PdfViewerParams(
          onViewerControllerInitialized: (PdfViewerController c) {
            controller = c;
          },
        ),
      ),
      floatingActionButton: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          FloatingActionButton(
            child: Icon(Icons.first_page),
            onPressed: () => controller?.ready?.goToPage(pageNumber: 1),
          ),
          FloatingActionButton(
            child: Icon(Icons.last_page),
            onPressed: () => controller?.ready?.goToPage(pageNumber: controller?.pageCount ?? 1),
          ),
        ],
      ),
    );
  }
}

API Overview #

Widgets #

  • PdfViewer: Full-featured PDF viewer with zoom, pan, and navigation
  • PdfDocumentLoader: Loads and manages PDF documents
  • PdfPageView: Renders individual PDF pages

Core APIs #

  • PdfDocument: Main document class for PDF operations
  • PdfPage: Individual page representation
  • PdfPageImage: Rendered page image data
  • PdfPageImageTexture: High-performance texture rendering

Migration from Original Package #

If you're migrating from the original pdf_render package, simply change your import:

// Old import
import 'package:pdf_render/pdf_render.dart';
import 'package:pdf_render/pdf_render_widgets.dart';

// New import
import 'package:pdf_render_maintained/pdf_render.dart';
import 'package:pdf_render_maintained/pdf_render_widgets.dart';

And update your pubspec.yaml:

dependencies:
  pdf_render_maintained: ^1.5.3  # Instead of pdf_render: ^1.4.12

Contributing #

We welcome contributions! Please feel free to submit issues and pull requests.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments #

  • Original package by espresso3389
  • PDF.js by Mozilla for Web support
  • The Flutter community for their continued support

Note: This package maintains compatibility with the original pdf_render API while providing active maintenance and updates for modern Flutter versions.

1
likes
150
points
323
downloads

Publisher

verified publisherkhokan.me

Weekly Downloads

A maintained fork of pdf_render plugin providing PDF rendering APIs and Flutter widgets for iOS, Android, macOS, and Web.

Repository (GitHub)
View/report issues

Topics

#pdf #pdf-viewer #flutter #cross-platform #maintained

Documentation

API reference

License

MIT (license)

Dependencies

collection, flutter, flutter_web_plugins, plugin_platform_interface, vector_math

More

Packages that depend on pdf_render_maintained

Packages that implement pdf_render_maintained