pdf_text 0.1.0 copy "pdf_text: ^0.1.0" to clipboard
pdf_text: ^0.1.0 copied to clipboard

outdated

A Flutter plugin used to extract text from PDF documents.

PDF Text Plugin #

This plugin for Flutter allows you to read the text content of PDF documents and convert it into strings. The plugin works on iOS and Android. On iOS it uses Apple's PDFKit. On Android it uses Apache's PdfBox Android porting.

Getting Started #

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

dependencies:
  pdf_text: ^0.1.0

Usage #

Import the package with:

import 'package:pdf_text/pdf_text.dart';

Create a PDF document instance using a File object:

PDFDoc doc = await PDFDoc.fromFile(file);

or using a path string:

PDFDoc doc = await PDFDoc.fromPath(path);

Read the text of the entire document:

String docText = await doc.text;

Retrieve the number of pages of the document:

int numPages = doc.length;

Access a page of the document:

PDFPage page = doc.pageAt(pageNumber);

Read the text of a page of the document:

String pageText = await page.text;

Public Methods #

PDFDoc #

| Return | Description |

| PDFPage | pageAt(int pageNumber)
Gets the page of the document at the given page number. |

| static Future<PDFDoc> | fromFile(File file)
Creates a PDFDoc object with a File instance. |

| static Future<PDFDoc> | fromPath(String path)
Creates a PDFDoc object with a file path. |

Objects #

class PDFDoc {
  int length; // Number of pages of the document
  List<PDFPage> pages; // Pages of the document
  Future<String> text; // Text of the document
}

class PDFPage {
  int number; // Number of the page in the document
  Future<String> text; // Text of the page
}

Contribute #

If you have any suggestions, improvements or issues, feel free to contribute to this project. You can either submit a new issue or propose a pull request.

88
likes
0
pub points
91%
popularity

Publisher

verified publisheraluc.dev

A Flutter plugin used to extract text from PDF documents.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on pdf_text