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
CPDFReaderWidgetin 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:
- Web Demo: https://www.compdf.com/demo/webviewer
- Sample Project: https://github.com/ComPDFKit/compdfkit-pdf-sdk-flutter/tree/main/example
- Video Demo: https://youtu.be/I0Rz11iVAbE
โก Quick Start
Requirements: Flutter latest stable, Android
minSdkVersion 21+, iOS12+.
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 21or above. - Android: if you use
CPDFReaderWidget, useFlutterFragmentActivity. - 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 orCPDFReaderWidgetfor 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
โค๏ธ 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.
Libraries
- annotation/cpdf_annotation
- annotation/cpdf_annotation_registry
- annotation/cpdf_border_style
- annotation/cpdf_circle_annotation
- annotation/cpdf_freetext_annotation
- annotation/cpdf_image_annotation
- annotation/cpdf_ink_annotation
- annotation/cpdf_line_annotation
- annotation/cpdf_link_annotation
- annotation/cpdf_markup_annotation
- annotation/cpdf_note_annotation
- annotation/cpdf_signature_annotation
- annotation/cpdf_sound_annotation
- annotation/cpdf_square_annotation
- annotation/cpdf_stamp_annotation
- annotation/cpdf_text_attribute
- annotation/cpdf_text_stamp
- annotation/form/cpdf_checkbox_widget
- annotation/form/cpdf_combobox_widget
- annotation/form/cpdf_listbox_widget
- annotation/form/cpdf_signature_widget
- annotation/form/cpdf_text_widget
- annotation/form/cpdf_widget
- annotation/form/cpdf_widget_item
- annotation/form/cpdf_widget_registry
- compdfkit
- configuration/attributes/cpdf_annot_attr_base
- configuration/attributes/cpdf_arrow_attr
- configuration/attributes/cpdf_circle_attr
- configuration/attributes/cpdf_editor_text_attr
- configuration/attributes/cpdf_freetext_attr
- configuration/attributes/cpdf_highlight_attr
- configuration/attributes/cpdf_ink_attr
- configuration/attributes/cpdf_line_attr
- configuration/attributes/cpdf_markup_attr
- configuration/attributes/cpdf_shape_attr
- configuration/attributes/cpdf_square_attr
- configuration/attributes/cpdf_squiggly_attr
- configuration/attributes/cpdf_strikeout_attr
- configuration/attributes/cpdf_text_attr
- configuration/attributes/cpdf_underline_attr
- configuration/attributes/form/cpdf_checkbox_attr
- configuration/attributes/form/cpdf_combobox_attr
- configuration/attributes/form/cpdf_listbox_attr
- configuration/attributes/form/cpdf_signature_widget_attr
- configuration/attributes/form/cpdf_textfield_attr
- configuration/config/cpdf_bota_config
- configuration/config/cpdf_page_editor_config
- configuration/config/cpdf_search_config
- configuration/config/cpdf_ui_style_config
- configuration/cpdf_configuration
- configuration/cpdf_options
- document/action/cpdf_action
- document/action/cpdf_goto_action
- document/action/cpdf_named_action
- document/action/cpdf_uri_action
- document/cpdf_bookmark
- document/cpdf_destination
- document/cpdf_document
- document/cpdf_document_permission_info
- document/cpdf_font_name
- document/cpdf_info
- document/cpdf_outline
- document/cpdf_watermark
- edit/cpdf_edit_area
- edit/cpdf_edit_image_area
- edit/cpdf_edit_manager
- edit/cpdf_edit_text_area
- edit/cpdf_image_data
- history/cpdf_annotation_history_manager
- history/cpdf_editor_history_manager
- history/cpdf_history_manager_base
- page/cpdf_page
- page/cpdf_search_options
- page/cpdf_text_range
- page/cpdf_text_searcher
- toolbar/cpdf_custom_toolbar_item
- util/cpdf_date
- util/cpdf_file_util
- util/cpdf_rectf
- util/cpdf_uuid_util
- util/cpdf_widget_util
- util/extension/cpdf_color_extension
- widgets/cpdf_reader_slider_bar
- widgets/cpdf_reader_widget
- widgets/cpdf_reader_widget_callbacks
- widgets/cpdf_reader_widget_controller