製品を閲覧する

If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.


Product Docs Swagger Examples Blog Support Dashboard

インストール

パッケージは、available Packagist にあり、Composer 経由で次のコマンドを実行してインストールできます。

composer require groupdocscloud/groupdocs-parser-cloud

Packagist Version Packagist Downloads PHP-GroupDocsCloud


要件

  • PHP 8.1 以降
  • Composer
  • PHP 拡張機能 — curl, json, mbstring
  • GroupDocs Cloud 認証情報 — Client ID and Client Secret ダッシュボードから

依存関係

SDK には次のパッケージが必要です。

PackageConstraint
guzzlehttp/guzzle^6.5.8 or ^7.4.5
ext-curl*
ext-json*
ext-mbstring*

クイックスタート

API 認証情報を取得する

GroupDocs.Parser Cloud を使用するには、GroupDocs.Cloud Dashboard でサインアップし、クライアント ID と クライアント シークレット を取得します。

API を初期化する

GroupDocs.Parser Cloud SDK for PHP の使用を開始するには、次のコードを使用します。

<?php

require_once(__DIR__ . '/vendor/autoload.php');

// Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
$configuration = new GroupDocs\Parser\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$parseApi = new GroupDocs\Parser\ParseApi($configuration);

完全な例は Utils.php を参照してください。

ドキュメントからテキストを抽出する

初期化したら、この基本的な例を使用して、クラウド ストレージ内のドキュメントからテキストを抽出します。

<?php

require_once(__DIR__ . '/vendor/autoload.php');

use GroupDocs\Parser\Model;
use GroupDocs\Parser\Model\Requests;

$configuration = new GroupDocs\Parser\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$parseApi = new GroupDocs\Parser\ParseApi($configuration);

$options = new Model\TextOptions();

$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("email/eml/embedded-image-and-attachment.eml");
$options->setFileInfo($fileInfo);

$request = new Requests\textRequest($options);
$result = $parseApi->text($request);

echo "Text: " . $result->getText() . "\n";

完全な例は ExtractTextFromTheWholeDocument.php を参照してください。

サポートされているファイル形式を取得する

サポートされているファイル形式を取得します。

<?php

require_once(__DIR__ . '/vendor/autoload.php');

$configuration = new GroupDocs\Parser\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$infoApi = new GroupDocs\Parser\InfoApi($configuration);

$result = $infoApi->getSupportedFileFormats();

foreach ($result->getFormats() as $format) {
    echo $format->getExtension() . ": " . $format->getFileFormat() . "\n";
}

完全な例は GetSupportedFileTypes.php を参照してください。

テンプレートでドキュメントを解析する

この例では、クラウド ストレージに保存されたテンプレートでドキュメントを解析し、テキスト フィールドとテーブル セルを読み取ります。

<?php

require_once(__DIR__ . '/vendor/autoload.php');

use GroupDocs\Parser\Model;
use GroupDocs\Parser\Model\Requests;

$configuration = new GroupDocs\Parser\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$parseApi = new GroupDocs\Parser\ParseApi($configuration);

$options = new Model\ParseOptions();

$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("words-processing/docx/companies.docx");
$options->setFileInfo($fileInfo);
$options->setTemplatePath("templates/companies.json");

$request = new Requests\parseRequest($options);
$result = $parseApi->parse($request);

foreach ($result->getFieldsData() as $data) {
    if ($data->getPageArea()->getPageTextArea() != null) {
        echo "Field name: " . $data->getName() . ". Text: " . $data->getPageArea()->getPageTextArea()->getText() . "\n";
    }

    if ($data->getPageArea()->getPageTableArea() != null) {
        echo "Table name: " . $data->getName() . "\n";
        foreach ($data->getPageArea()->getPageTableArea()->getPageTableAreaCells() as $cell) {
            echo "Row " . $cell->getRowIndex() . " column " . $cell->getColumnIndex() . ": " . $cell->getPageArea()->getPageTextArea()->getText() . "\n";
        }
    }
}

完全な例は ParseByTemplateStoredInUserStorage.php を参照してください。

ドキュメントから画像を抽出する

この例では、プレゼンテーションから埋め込み画像を抽出し、各ストレージ パスとダウンロード URL を出力します。

<?php

require_once(__DIR__ . '/vendor/autoload.php');

use GroupDocs\Parser\Model;
use GroupDocs\Parser\Model\Requests;

$configuration = new GroupDocs\Parser\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");

$parseApi = new GroupDocs\Parser\ParseApi($configuration);

$options = new Model\ImagesOptions();

$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("slides/three-slides.pptx");
$options->setFileInfo($fileInfo);

$request = new Requests\imagesRequest($options);
$result = $parseApi->images($request);

foreach ($result->getImages() as $image) {
    echo "Image path: " . $image->getPath() . ". Download url: " . $image->getDownloadUrl() . "\n";
    echo "Format: " . $image->getFileFormat() . ". Page index: " . $image->getPageIndex() . "\n";
}

完全な例は ExtractImagesFromTheWholeDocument.php を参照してください。

GitHub の例

GroupDocs.Parser Cloud PHP Examples リポジトリには、以下をカバーするすぐに実行できるサンプルが含まれています。

CategoryExamples
情報サポートされているファイル形式、ドキュメント情報、コンテナ アイテム
テキストの抽出ドキュメント全体、書式設定されたテキスト、ページ番号の範囲、コンテナ内のドキュメント
画像の抽出ドキュメント全体、ページ番号の範囲、コンテナ内のドキュメント
テンプレートによる解析ユーザー ストレージに保存されたテンプレート、オブジェクトとして定義されたテンプレート、コンテナ内のドキュメント
AI による解析テンプレートを使用して AI でドキュメントを解析
テンプレートテンプレートの作成または更新、取得、削除

サンプルの実行方法

  1. 例のリポジトリ のクローンを作成するか、ダウンロードします。
  2. Examples/Utils.php を編集し、AppSid と AppKey を設定します。
  3. Examples ディレクトリに移動します。
  4. composer update を実行します。
  5. php RunExamples.php を実行します。

詳細については、次のサイトをご覧ください。 Getting Started.


Product Docs Swagger Examples Blog Support Dashboard


タグ

Document Data Extraction | PHP Cloud API | GroupDocs.Parser Cloud | REST API | Text Extraction | Image Extraction | Template Parsing | Data Parsing | Document Information | Container Files | Cloud Storage Integration | File Operations | Folder Operations | Secure API Access | Document Parsing | Metadata Extraction | PDF Parsing | ZIP Files | PST/OST Files | Cross-platform API | Document Processing | Data Extraction API



 日本