read_pdf_text 0.0.8
read_pdf_text: ^0.0.8 copied to clipboard
This is a plugin that parses string out of pdf documents. It uses apache PDFbox to parse the pdf document. There is only three functions so it is simple to use.
read_pdf_text #
This package parses text out of PDF documents and returns it as a string. On Android the plugin uses PDFbox open source library. The iOS version is not implemented yet.
Getting Started #
The package only has three functions getPDFtext(path), getPDFtextPaginated(path) and getPDFlength(path). Path is the file path to the PDF file you want to parse. I used file_picker package in the example to get the path of PDF file.
Check the example for more details.
Example #
[read_pdf_text.gif]
getPDFtext(String path) #
Returns all text from PDF file as a String.
Future<String> getPDFtext(String path) async {
String text = "";
try {
text = await ReadPdfText.getPDFtext(path);
} on PlatformException {
text = 'Failed to get PDF text.';
}
return text;
}
getPDFtextPaginated(path) #
Returns all text from PDF but in a List
Future<List<String>> getPDFtextPaginated(String path) async {
List<String> textList = List<String>();
try {
textList = await ReadPdfText.getPDFtextPaginated(path);
} on PlatformException {}
return textList;
}
getPDFlength(path) #
Returns length of the document as integer.
Future<int> getPDFlength(String path) async {
int length = 0;
try {
length = await ReadPdfText.getPDFlength(path);
} on PlatformException {}
return length;
}