搜尋套件、儲存庫與 APP 分類

read_pdf_text 封面
套件詳情v0.3.1

read_pdf_text

這是一個從PDF文件中解析字串的外掛程式。它使用Apache PDFBox和PDFKit來解析PDF文件。只有三個函數,因此使用起來非常簡單。

AndroidiOS
近 30 天下載
6080
喜歡數
52
Pub 分數
140

安裝套件

flutter pub add read_pdf_text

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

read_pdf_text 套件是一個簡單的 Flutter 外掛程式,用於從 PDF 文件中提取文字。它在底層使用 Apache PDFBox 和 PDFKit 來有效解析 PDF 內容。僅需三個簡單函數,即可為需要基本文字提取功能的開發者提供易於使用的介面。適用於需要從 PDF 中讀取或處理文字但不需要複雜格式的應用程式。此外掛程式支援 Android 與 iOS 平台。

適用情境

  • 從掃描的PDF中提取文本
  • 在應用程式中讀取文件內容
  • 解析用戶上傳的PDF文件
  • 簡單的PDF文本分析
  • 將PDF內容整合到基於文字的功能中

主要特色

  • 僅包含三個函數的最小 API
  • 使用可靠的PDF解析庫
  • 跨平台支援(Android 與 iOS)
  • 輕量且易於整合
  • 從PDF快速提取文字

適合對象

  • 開發文件閱讀器的開發者
  • 需要基本PDF文本提取的應用程式
  • PDF處理需求有限的專案
  • 處理使用者提交的PDF的行動應用程式
  • 需要快速訪問PDF文本的原型

使用建議

  • 僅限文字提取
  • 不支援影像或進階PDF功能
  • 依賴於底層 PDFBox/PDFKit 的效能
  • 可能難以處理高度加密或掃描的PDF檔
  • 不支援 PDF 編輯或呈現

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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 {
      print('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 {
      print('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 {
      print('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

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。