compdfkit_flutter 2.6.6 copy "compdfkit_flutter: ^2.6.6" to clipboard
compdfkit_flutter: ^2.6.6 copied to clipboard

ComPDFKit for Flutter is a comprehensive SDK that allows you to quickly add PDF functionality to Android and iOS Flutter applications.

PDF SDK for Flutter | View, Annotate, Edit & Sign PDFs in Mobile Apps #

ComPDF for Flutter helps developers build mobile PDF experiences on iOS and Android with PDF viewing, annotation, editing, form filling, redaction, and signatures. For products that also need Convert, OCR, and Generate workflows, ComPDF can be paired with ComPDF API to support end-to-end document workflow and automation use cases.

๐Ÿš€ Why ComPDF #

ComPDF is designed for teams that want a production-ready PDF layer in Flutter without stitching together a low-level renderer, custom UI, and separate commercial support.

Why developers choose it:

  • Mobile performance: fast, high-fidelity PDF rendering for real app usage, including large documents.
  • Cross-platform delivery: one Flutter integration for both iOS and Android.
  • Built-in UI + Flutter embedding: open documents with the default UI or embed CPDFReaderWidget in your own Flutter screen.
  • Commercial readiness: trial license, enterprise licensing, SDK support, and API options for broader document workflows.
  • Cleaner integration path: easier to ship than building document review and editing experiences from scratch.

๐ŸŽฌ Live Demo #

Try ComPDF in action:

โšก Quick Start #

Requirements: Flutter latest stable, Android minSdkVersion 21+, iOS 12+.

1. Install #

flutter pub add compdfkit_flutter

2. Add your license and sample PDF #

flutter:
  assets:
    - assets/license_key_flutter.xml
    - pdfs/PDF_Document.pdf

Platform notes

  • Android: use minSdkVersion 21 or above.
  • Android: if you use CPDFReaderWidget, use FlutterFragmentActivity.
  • iOS: use iOS 12+ and follow the official Pod integration guide when adding native ComPDF pods manually.

3. Initialize and open a PDF #

import 'dart:io';

import 'package:compdfkit_flutter/compdfkit.dart';
import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart';
import 'package:compdfkit_flutter/util/cpdf_file_util.dart';
import 'package:flutter/material.dart';

const String documentAsset = 'pdfs/PDF_Document.pdf';

void main() {
  runApp(const MaterialApp(home: HomePage()));
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  void initState() {
    super.initState();
    _initializeSdk();
  }

  Future<void> _initializeSdk() async {
    final File licenseFile = await CPDFFileUtil.extractAsset(
      context,
      'assets/license_key_flutter.xml',
    );
    await ComPDFKit.initWithPath(licenseFile.path);
  }

  Future<void> _openDocument() async {
    final pdfFile = await CPDFFileUtil.extractAsset(documentAsset);
    ComPDFKit.openDocument(
      pdfFile.path,
      password: '',
      configuration: CPDFConfiguration(),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          onPressed: _openDocument,
          child: const Text('Open PDF'),
        ),
      ),
    );
  }
}

๐Ÿงฉ Key Features #

  • ๐Ÿ“„ PDF Viewing & Navigation
    View PDFs with smooth scrolling, thumbnails, and search-ready reading experiences.
    ๐Ÿ‘‰ Use case: mobile document readers, case files, knowledge apps

  • โœ๏ธ Annotation & Review
    Highlight, comment, draw, and review documents inside the app.
    ๐Ÿ‘‰ Use case: contract review, classroom markup, team approval flows

  • ๐Ÿ› ๏ธ Editing, Forms, Redaction & Signatures
    Go beyond viewing with document completion and protection features.
    ๐Ÿ‘‰ Use case: onboarding forms, signed agreements, compliance workflows

  • ๐Ÿงฑ Plugin UI or Embedded Widget
    Choose the default viewer for fast rollout or CPDFReaderWidget for tighter Flutter UI integration.
    ๐Ÿ‘‰ Use case: branded document screens inside mobile apps

  • ๐Ÿ”„ Works with Convert / OCR / Generate Pipelines
    Pair the mobile SDK with ComPDF API when your app also needs backend document processing.
    ๐Ÿ‘‰ Use case: invoice capture apps, searchable archive workflows, generated PDF outputs

๐Ÿ’ก Use Cases #

  • Document Management Systems for mobile viewing, review, and approval
  • PDF Editors embedded in Flutter apps
  • Invoice Processing apps that upload files from mobile and route OCR/conversion to backend workflows
  • Field Service & Sales Apps for forms, checklists, contracts, and signatures
  • Legal, Finance, and Healthcare Apps that need secure document review on mobile

๐Ÿงช Code Snippets #

Open a document with the built-in viewer #

import 'dart:io';

import 'package:compdfkit_flutter/compdfkit.dart';
import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart';
import 'package:compdfkit_flutter/util/cpdf_file_util.dart';
import 'package:flutter/material.dart';

Future<void> openSampleDocument(BuildContext context) async {
  final File licenseFile = await CPDFFileUtil.extractAsset(
    context,
    'assets/license_key_flutter.xml',
  );
  await ComPDFKit.initWithPath(licenseFile.path);

  final pdfFile = await CPDFFileUtil.extractAsset('pdfs/PDF_Document.pdf');
  ComPDFKit.openDocument(
    pdfFile.path,
    password: '',
    configuration: CPDFConfiguration(),
  );
}

Embed CPDFReaderWidget and enable only viewer + annotation modes #

import 'package:compdfkit_flutter/configuration/cpdf_configuration.dart';
import 'package:compdfkit_flutter/widgets/cpdf_reader_widget.dart';
import 'package:flutter/material.dart';

class ReviewPage extends StatelessWidget {
  const ReviewPage({super.key, required this.documentPath});

  final String documentPath;

  @override
  Widget build(BuildContext context) {
    final configuration = CPDFConfiguration(
      modeConfig: ModeConfig(
        initialViewMode: CPreviewMode.viewer,
        availableViewModes: [
          CPreviewMode.viewer,
          CPreviewMode.annotations,
        ],
      ),
    );

    return Scaffold(
      appBar: AppBar(title: const Text('Review PDF')),
      body: CPDFReaderWidget(
        document: documentPath,
        configuration: configuration,
      ),
    );
  }
}

๐Ÿ”— Documentation & Resources #

Resource Link
Official Docs https://www.compdf.com/guides/pdf-sdk/flutter/overview
API Reference https://pub.dev/documentation/compdfkit_flutter/latest/
GitHub https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter
Demo https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter/tree/main/example

โค๏ธ Engagement #

If you find this package useful, please ๐Ÿ‘ Like it on pub.dev to support us!

ComPDF is a practical PDF SDK for Flutter teams that need mobile UI integration today and room to expand into larger document workflows later.

51
likes
130
points
279
downloads

Documentation

Documentation
API reference

Publisher

verified publishercompdf.com

Weekly Downloads

ComPDFKit for Flutter is a comprehensive SDK that allows you to quickly add PDF functionality to Android and iOS Flutter applications.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on compdfkit_flutter

Packages that implement compdfkit_flutter