Tidak Ada Deskripsi

liuxiaolong e7b6be6279 Conversion(flutter) ios端原生代码 1 tahun lalu
android c8f171504a Conversion(flutter) 1.优化代码 1 tahun lalu
example c8f171504a Conversion(flutter) 1.优化代码 1 tahun lalu
ios e7b6be6279 Conversion(flutter) ios端原生代码 1 tahun lalu
lib c8f171504a Conversion(flutter) 1.优化代码 1 tahun lalu
.gitignore ab7ccc1283 【代码优化】 1.重构工程代码结构,修改为插件化(仅Android部分) 1 tahun lalu
.metadata ab7ccc1283 【代码优化】 1.重构工程代码结构,修改为插件化(仅Android部分) 1 tahun lalu
CHANGELOG.md b5c4473a4d 【代码优化】 1.优化部分代码问题 1 tahun lalu
LICENSE ab7ccc1283 【代码优化】 1.重构工程代码结构,修改为插件化(仅Android部分) 1 tahun lalu
README.md c8f171504a Conversion(flutter) 1.优化代码 1 tahun lalu
analysis_options.yaml ab7ccc1283 【代码优化】 1.重构工程代码结构,修改为插件化(仅Android部分) 1 tahun lalu
pubspec.lock ab7ccc1283 【代码优化】 1.重构工程代码结构,修改为插件化(仅Android部分) 1 tahun lalu
pubspec.yaml b5c4473a4d 【代码优化】 1.优化部分代码问题 1 tahun lalu

README.md

Introduction to Conversion SDK Flutter

ComPDFKit Conversion SDK for Flutter is a powerful conversion library. Developers can seamlessly integrate PDF documents to Office documents conversion SDK into their applications and services running.

Overview

Key Features

  • Convert PDF documents to Word documents.
    • Reconstruct content from PDF files into reusable data.
    • Reconstruction (recover page layout, columns, formatting, graphics, and preserve text flow).
    • Support mapping conversion to split-column function.
    • Support the function of combining letters into a string of text.
    • Support floating insertion such as picture rotation cutting.
    • Support converting partial Math or Chemistry function.
    • Support font size, color, bold, italic, and underline recognition.
    • Support two layout options to choose from: Retain Flowing Text and Retain Page Layout.
  • Convert PDF documents to Excel documents.
    • Support data mapping to Excel cells.
    • Support recognition of a small number, currency, and other formats.
    • Support multiple cells merge function.
    • Support different types of content, including text, table, or all content in PDF.
    • Support multiple Worksheet options, including converting one table to one sheet, all tables on one page to one sheet, or all tables in the entire document to one sheet.
  • Convert PDF documents to PPT documents.
    • Convert each page to an editable slide.
    • Support converting text to a PowerPoint text box.
    • Support picture rotation cutting and other floating insertion.
    • Support converting partial Math or Chemistry function.
  • Convert PDF documents to TXT documents.
  • Convert PDF documents to CSV documents.
    • Support extracting only tables from PDF accurately and converting them to CSV, and one table is converted to one CSV file. Or you can also merge multiple tables into one CSV file.
  • Convert PDF documents to Image documents.
    • Support converting PDF to high-quality image formats, including PNG and JPEG. All image quality and resolution will remain intact. And the image DPI can be set freely.
  • Convert PDF documents to RTF documents.
    • Support converting PDF to Rich Text Format documents, including text and images.
  • Convert PDF documents to HTML documents.
    • Support converting PDF to HTML, including single-page and multiple-page.

More information can be found at https://www.compdf.com/guides/conversion-sdk/android/overview

Installation

  1. First follow the Flutter getting started guides to Install, set up an editor, and Create a Flutter Project. The rest of this guide assumes your project is created by running flutter create myapp.

  2. Add the following dependency to your Flutter project in myapp/pubspec.yaml file:

  • If you want to use our null safe package from pub.dev: ```diff dependencies: flutter: sdk: flutter
  • kmpdfkit_conversion_flutter: ```
  • Run the following command in the myapp directory to retrieve the dependencies: flutter packages get

Usage

  1. Open lib/main.dart, and add the following code:
  @override
  void initState() {
    super.initState();
+   CPDFConverter.init("your ComPDFKit key","your ComPDFKit secret");
  }
  1. To select a local PDF file, add the following dependencies to the myapp/pubspec.yaml file:
dependencies:
    flutter:
      sdk: flutter
    kmpdfkit_conversion_flutter:
+   file_picker: ^5.2.5
+   permission_handler: ^10.2.0
  1. After obtaining the storage permission, use the FilePicker plugin to select the PDF file that needs to be converted:
  ///request storage permission
  Future<bool> getPermission() async {
    var status = await Permission.storage.request();
    return status.isGranted;
  }

  ///Select pdf files from android\ios using 'file_picker'
  Future<List<String>> getPDFFileList(BuildContext context) async {
    bool isGranted = await getPermission();
    if (!isGranted) {
      return List.empty();
    }
    FilePickerResult? result = await FilePicker.platform.pickFiles(
        type: FileType.custom, allowedExtensions: ['pdf'], allowMultiple: true);
    if (result != null) {
      List<String?> pdfFiles = result.paths;
      var files = pdfFiles.where((element) => element != null);
      return List.from(files);
    } else {
      return List.empty();
    }
  }
  1. Convert file formats using the Conversion SDK:
  List<String> files = await getPDFFileList(context);

  CPDFConverter.convert(
        taskId: const Uuid().v4(),
        filePath: files.get(0),
        convertType: ConvertType.ppt,
        options: ConvertPPTOptions(),
        callback: (TaskResult result) {
          var taskId = result.taskId;
          var progress = result.progress;
          var taskStatus = result.taskStatus;
          var outPutPath = result.outPutPath;
        });
  1. Cancel the conversion task: dart CPDFConverter.cancelTask();

Changelog

See Changelog

License

See License