This is a flutter package that parses pdf documents to strings

Overview

read_pdf_text

This package parses text out of PDF document and returns it as a string.

Android

On Android the plugin uses PDFbox open source library modified by Tom Roush.

iOS

The iOS plugin uses PDFKit to parse the text out of PDF documents. It requires iOS version 11 or higher.

For error like: "Could not find or use auto-linked library 'swiftObjectiveC'"

Solution can be found here: https://stackoverflow.com/a/54586937/2881394

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 the PDF file.

Check the example for more details.

Example

read_pdf_text.gif

getPDFtext(String path)

Returns 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(String path)

Returns text from PDF but in a String list, where each item is a page of the PDF file.

  Future<List<String>> getPDFtextPaginated(String path) async {
    List<String> textList = List<String>();
    try {
      textList = await ReadPdfText.getPDFtextPaginated(path);
    } on PlatformException {
      text = 'Failed to get PDF text.';
    }
    return textList;
  }

getPDFlength(String path)

Returns length of the document as an integer.

  Future<int> getPDFlength(String path) async {
    int length = 0;
    try {
      length = await ReadPdfText.getPDFlength(path);
    } on PlatformException {
      text = 'Failed to get PDF length';
    }
    return length;
  }

I wrote an article about developing package for Flutter check it out

How to write Flutter plugin --1

You might also like...

A Flutter package for show custom in-app notification.

A Flutter package for show custom in-app notification.

💬 in_app_notification A Flutter package to show custom in-app notification with any Widgets. ✍️ Usage Import it. dependencies: in_app_notificatio

Oct 27, 2022

A Flutter package for working with piano keys and sheet music

A Flutter package for working with piano keys and sheet music

Piano A Flutter package that provides: logic for working with musical notes, clefs and octaves; a widget that can render notes on a clef; an interacti

Jan 5, 2023

A Flutter package to simplify firebase authentication.

firebase_authentication A Flutter package to simplify firebase authentication. Development State This is in a very, very early stage. It's a draft bas

Apr 24, 2022

A Flutter package for building custom skeleton widgets to mimic the page's layout while loading.

A Flutter package for building custom skeleton widgets to mimic the page's layout while loading.

Skeletons A Flutter package for building custom skeleton widgets to mimic the page's layout while loading. Examples Items ListView (Default) ListView

Dec 17, 2022

A Flutter package to manage feature flagging.

feature_flags This package simply allows you to activate dynamically functionnalities of your app. Usage Setup Wrap your app's widget in a Features wi

Oct 11, 2022

An flutter package to use DevIcons https://devicon.dev/

An flutter package to use DevIcons https://devicon.dev/

dev_icons This flutter package allows you to use all the Dev Icons. You can view the icons catalog on devicon.dev Installation In the dependencies: se

Oct 9, 2022

A set of real world timelines to showcase the use of timeline_tile package, built with Flutter.

A set of real world timelines to showcase the use of timeline_tile package, built with Flutter.

beatiful_timelines Beautiful timelines built with Flutter and timeline_tile. Current examples: Timeline Showcase Football Timeline Activity Timeline S

Dec 21, 2022

A Dart/Flutter package to register/query/remove URI Schemes without hassle.

protocol_registry Register/query/remove URI Schemes without hassle. Available for Windows and Linux. Installation flutter pub add protocol_registry Us

Oct 25, 2022

Flutter network manager package.

Flutter network manager package.

Features With Network Manager, you can now easily manage your internet requests, send and receive data. Usage Set Base URL Settings Base URL - Networ

Dec 4, 2022
Comments
  • Update plugin

    Update plugin

    Hi, With the latest updates, this plugin is not working anymore.

    Android

    Running Gradle task 'assembleDebug'...
    Note: /Users/mac/Development/flutter/.pub-cache/hosted/pub.dartlang.org/read_pdf_text-0.1.1/android/src/main/java/com/example/read_pdf_text/ReadPdfTextPlugin.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    

    iOS

    CocoaPods' output:
    ↳
    Error running pod install
    Error launching application on iPhone 11 Pro Max.
      Preparing
    
    Analyzing dependencies
    
    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    
    Finding Podfile changes
      A read_pdf_text
      - Flutter
      - path_provider
      - path_provider_linux
      - path_provider_macos
      - permission_handler
      - qr_code_scanner
      - receive_sharing_intent
    
    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `path_provider` from `.symlinks/plugins/path_provider/ios`
    -> Fetching podspec for `path_provider_linux` from `.symlinks/plugins/path_provider_linux/ios`
    -> Fetching podspec for `path_provider_macos` from `.symlinks/plugins/path_provider_macos/ios`
    -> Fetching podspec for `permission_handler` from `.symlinks/plugins/permission_handler/ios`
    -> Fetching podspec for `qr_code_scanner` from `.symlinks/plugins/qr_code_scanner/ios`
    -> Fetching podspec for `read_pdf_text` from `.symlinks/plugins/read_pdf_text/ios`
    -> Fetching podspec for `receive_sharing_intent` from `.symlinks/plugins/receive_sharing_intent/ios`
    
    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: all_pods_versions_0_2_a.txt exists! Returning local because checking is only perfomed in repo update
      CDN: trunk Relative path: Specs/0/2/a/MTBBarcodeScanner/5.0.11/MTBBarcodeScanner.podspec.json exists! Returning local because checking is only perfomed in repo update
    [!] CocoaPods could not find compatible versions for pod "read_pdf_text":
      In Podfile:
        read_pdf_text (from `.symlinks/plugins/read_pdf_text/ios`)
    
    Specs satisfying the `read_pdf_text (from `.symlinks/plugins/read_pdf_text/ios`)` dependency were found, but they required a higher minimum deployment target.
    
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:328:in `raise_error_unless_state'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:310:in `block in unwind_for_conflict'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `tap'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:308:in `unwind_for_conflict'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:254:in `process_topmost_state'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolution.rb:182:in `resolve'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/molinillo-0.6.6/lib/molinillo/resolver.rb:43:in `resolve'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/resolver.rb:94:in `resolve'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1065:in `block in resolve_dependencies'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:1063:in `resolve_dependencies'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:410:in `analyze'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:235:in `block in resolve_dependencies'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/user_interface.rb:64:in `section'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:234:in `resolve_dependencies'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/installer.rb:156:in `install!'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/command/install.rb:52:in `run'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/lib/cocoapods/command.rb:52:in `run'
    /Users/mac/.rvm/rubies/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/cocoapods-1.9.3/bin/pod:55:in `<top (required)>'
    /Users/mac/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `load'
    /Users/mac/.rvm/rubies/ruby-2.4.1/bin/pod:23:in `<main>'
    /Users/mac/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:24:in `eval'
    /Users/mac/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:24:in `<main>'
    
    Error output from CocoaPods:
    ↳
    
    [!] Automatically assigning platform `iOS` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
    

    I really would love this plugin to work, since is the only one which can extract text from the pdf and use it for my own purpoes.

    Thanks

    opened by NindoK 8
  • Background young concurrent copying GC freed 515270(13MB) AllocSpace objects, 19(4168KB) LOS objects, 34% free, 25MB/39MB, paused 90us total 110.917ms

    Background young concurrent copying GC freed 515270(13MB) AllocSpace objects, 19(4168KB) LOS objects, 34% free, 25MB/39MB, paused 90us total 110.917ms

    A resource failed to call end. Background young concurrent copying GC freed 515270(13MB) AllocSpace objects, 19(4168KB) LOS objects, 34% free, 25MB/39MB, paused 90us total 110.917ms May I know what the cause of this probleme?

    opened by SopheaII 2
  • Add info to the documentation about creating Bridging Header for Swift

    Add info to the documentation about creating Bridging Header for Swift

    I faced multiple linker errors on iOS like:

    Could not find or use auto-linked library 'swiftObjectiveC

    Then found the solution here: https://stackoverflow.com/a/54586937/2881394 I think this should be added to the Installation section of the documentation.

    opened by lastant 2
A documents-organizing desktop app built with flutter

Army Book Desktop App a documents-organizing desktop app Screenshots Change Log see change log Plugins Momentum (State management) Sembast (Database)

Đỗ Doãn Phước Hưng 2 Jan 10, 2022
Flutter Widget to display PDF

pdf_flutter Inspired by Pdf_Viewer_Plugin ?? Wrapped around AndroidPdfViewer on Android. ???? 1. Add pdf_flutteron pubspec.yml dependencies: pdf_flu

Laxman Bhattarai 100 Sep 7, 2022
A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully & easily modifiable.

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully

Muhammad Hamza 21 Jan 1, 2023
Flutter 2.0 (Null safety) Basic, Dynamic & Silver style Staggered Grid views made using flutter staggered grid view package. 🦺

Staggered Grid View Developement Stack Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Nakshatra Singh 9 Oct 28, 2022
A Flutter package that makes it easy to customize and work with your Flutter desktop app's system tray.

system_tray A Flutter package that that enables support for system tray menu for desktop flutter apps. on Windows, macOS and Linux. Features: - Modify

AnTler 140 Dec 30, 2022
A Flutter package that makes it easy to customize and work with your Flutter desktop app window.

bitsdojo_window A Flutter package that makes it easy to customize and work with your Flutter desktop app window on Windows, macOS and Linux. Watch the

Bits Dojo 606 Dec 27, 2022
In this video, we learn how to do integrate Google Admob with Flutter with latest Flutter 2.0 Google Admob Package.

?? Monetizing Flutter apps with Google AdMob ?? In this video, we learn how to do integrate Google Admob with Flutter with latest Flutter 2.0 Google A

SnippetCoder 14 Nov 30, 2022
Firebase Cloud Messaging (FCM) Flutter package.

Firebase Messaging Plugin for Flutter A Flutter plugin to use the Firebase Cloud Messaging API. To learn more about Firebase Cloud Messaging, please v

Wael Alhalabi 12 Dec 10, 2022
A Flutter project that implemented getx package and firebase services.

Get X Firebase A Flutter Package that implemented firebase services with getx package. It's free, open source, complete, rapid development package for

Faisal Ramdan 19 Nov 26, 2022
A Flutter package for getting app feedback from users.

App Feedback A Flutter package for getting app feedback from users. Other Flutter packages Name Stars Pub Filter List Empty widget Add Thumbnail Count

Sonu Sharma 11 Nov 13, 2022