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.
If you experience errors, when you try to download a file, make sure your network policies (enforced by your company or ISP) allow downloading ZIP and/or MSI files.

インストール
パッケージは、available Packagist にあり、次のコマンドを実行することで Composer 経由でインストールできます。
composer require groupdocscloud/groupdocs-viewer-cloud

要件
依存関係
SDK には次のパッケージが必要です。
| Package | Constraint |
|---|
| guzzlehttp/guzzle | ^6.5.8 or ^7.4.5 |
| ext-curl | * |
| ext-json | * |
| ext-mbstring | * |
クイックスタート
API 認証情報を取得する
GroupDocs.Viewer Cloud を使用するには、GroupDocs.Cloud Dashboard でサインアップし、クライアント ID と クライアント シークレット を取得します。
API を初期化する
GroupDocs.Viewer Cloud SDK for PHP の使用を開始するには、次のコードを使用します。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Get your ClientId and ClientSecret at https://dashboard.groupdocs.cloud
$configuration = new GroupDocs\Viewer\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$viewApi = new GroupDocs\Viewer\ViewApi($configuration);
完全な例は Utils.php を参照してください。
ドキュメントを変換してダウンロードする (直接、クラウド ストレージなし)
初期化したら、この基本的な例を使用してローカル ドキュメントを JPG に変換し、結果を直接受け取ります。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use GroupDocs\Viewer\Model\Requests;
$configuration = new GroupDocs\Viewer\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$viewApi = new GroupDocs\Viewer\ViewApi($configuration);
$format = "jpg";
$filePath = __DIR__ . "/sample.docx";
$request = new Requests\convertAndDownloadRequest($format, $filePath);
$result = $viewApi->convertAndDownload($request);
echo "Document converted: " . $result->getSize() . "\n";
完全な例は ConvertAndDownload.php を参照してください。
レスポンシブ HTML でドキュメントをレンダリングする
この例では、クラウド ストレージ上の Word ドキュメントをレスポンシブ HTML としてレンダリングします。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use GroupDocs\Viewer\Model;
use GroupDocs\Viewer\Model\Requests;
$configuration = new GroupDocs\Viewer\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$viewApi = new GroupDocs\Viewer\ViewApi($configuration);
$viewOptions = new Model\ViewOptions();
$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("SampleFiles/sample.docx");
$viewOptions->setFileInfo($fileInfo);
$viewOptions->setViewFormat(Model\ViewOptions::VIEW_FORMAT_HTML);
$renderOptions = new Model\HtmlOptions();
$renderOptions->setIsResponsive(true);
$viewOptions->setRenderOptions($renderOptions);
$request = new Requests\createViewRequest($viewOptions);
$response = $viewApi->createView($request);
echo "Responsive HTML rendered: " . count($response->getPages()) . "\n";
完全な例は HtmlViewerResponsiveLayout.php を参照してください。
選択したページをレンダリングする
この例では、1 ページ目と 3 ページ目のみをレンダリングします。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use GroupDocs\Viewer\Model;
use GroupDocs\Viewer\Model\Requests;
$configuration = new GroupDocs\Viewer\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$viewApi = new GroupDocs\Viewer\ViewApi($configuration);
$viewOptions = new Model\ViewOptions();
$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("SampleFiles/sample.docx");
$viewOptions->setFileInfo($fileInfo);
$viewOptions->setViewFormat(Model\ViewOptions::VIEW_FORMAT_HTML);
$renderOptions = new Model\HtmlOptions();
$renderOptions->setPagesToRender([1, 3]);
$viewOptions->setRenderOptions($renderOptions);
$request = new Requests\createViewRequest($viewOptions);
$response = $viewApi->createView($request);
echo "Selected pages rendered: " . count($response->getPages()) . "\n";
完全な例は RenderSelectedPages.php を参照してください。
サポートされているファイル形式を取得する
サポートされているファイル形式を取得します。
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$configuration = new GroupDocs\Viewer\Configuration();
$configuration->setAppSid("YourClientId");
$configuration->setAppKey("YourClientSecret");
$configuration->setApiBaseUrl("https://api.groupdocs.cloud");
$infoApi = new GroupDocs\Viewer\InfoApi($configuration);
$response = $infoApi->getSupportedFileFormats();
echo "Number of formats = " . count($response->getFormats()) . "\n";
完全な例は GetSupportedFormats.php を参照してください。
GitHub の例
GroupDocs.Viewer Cloud PHP Examples リポジトリには、以下をカバーするすぐに実行できるサンプルが含まれています。
| Category | Examples |
|---|
| 基本的な使い方 | サポートされている形式、ドキュメント情報、添付ファイル、変換とダウンロード |
| HTML ビューア | レスポンシブ レイアウト、HTML の縮小、フォントの除外、画像サイズの制限、印刷用の最適化 |
| 画像ビューア | 画像サイズ、JPG 品質、テキスト オーバーレイ、テキスト座標を調整 |
| PDF ビューア | PDF を保護し、JPG 品質を調整 |
| 一般的なレンダリング オプション | 透かし、ページの反転と回転、コメント、連続したページ、非表示ページ、メモ、選択したページ、カスタム フォント、ページの並べ替え、不足しているフォントの置換 |
| 読み込みオプション | 保護されたドキュメント、エンコードの指定 |
| ファイル タイプ別のレンダリング | アーカイブ、CAD、電子メール、Lotus Notes、MS Project、Outlook、PDF、スプレッドシート、テキスト、Visio、Word |
サンプルの実行方法
- 例のリポジトリ をクローンまたはダウンロードします。
Examples/Utils.php を編集し、Client Id と Client Secret を設定します。Examples ディレクトリに移動します。composer update を実行します。php RunExamples.php を実行します。
詳細については、次のサイトをご覧ください。Getting Started.

タグ
Document Rendering API | PHP Cloud API | GroupDocs.Viewer Cloud | REST API | HTML Rendering | PDF Conversion | Image Rendering | Document Viewing | Multi-Page Rendering | Document Streaming | CAD Rendering | E-Mail Message Rendering | Visio Rendering | MS Project Rendering | Outlook Data Rendering | Spreadsheet Rendering | Word Processing Rendering | Custom View Options | Responsive HTML | Attachment Rendering | Secure API Access | Cloud Storage Integration