浏览我们的产品

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

安装

此包在 nuget.org 上提供,可通过包管理器控制台执行以下命令安装:

NuGet\Install-Package GroupDocs.Merger-Cloud

Version NuGet NuGet-GroupDocsCloud


要求

  • .NET Framework 2.0 或 .NET Standard 2.0
  • NuGet
  • 面向 .NET Framework 2.0 时需要 System.Web
  • GroupDocs Cloud 凭据 — 仪表板中的 Client ID and Client Secret

快速入门

获取 API 凭据

要使用 GroupDocs.Merger Cloud,请在 GroupDocs.Cloud 仪表板 注册并获取 Client ID 和 Client Secret。

初始化 API

使用以下代码开始使用 GroupDocs.Merger Cloud SDK for .NET。

using GroupDocs.Merger.Cloud.Sdk.Api;
using GroupDocs.Merger.Cloud.Sdk.Client;

string MyClientId = "YourClientId";
string MyClientSecret = "YourClientSecret";

var config = new Configuration(MyClientId, MyClientSecret);
config.ApiBaseUrl = "https://api.groupdocs.cloud";

var apiInstance = new DocumentApi(config);

完整示例见 Common.cs。

合并文档

此示例将两个 Word 文档合并为一个文件。

using System.Collections.Generic;
using GroupDocs.Merger.Cloud.Sdk.Api;
using GroupDocs.Merger.Cloud.Sdk.Client;
using GroupDocs.Merger.Cloud.Sdk.Model;
using GroupDocs.Merger.Cloud.Sdk.Model.Requests;
using FileInfo = GroupDocs.Merger.Cloud.Sdk.Model.FileInfo;

var config = new Configuration("YourClientId", "YourClientSecret");
config.ApiBaseUrl = "https://api.groupdocs.cloud";
var apiInstance = new DocumentApi(config);

var options = new JoinOptions
{
    JoinItems = new List<JoinItem>
    {
        new JoinItem { FileInfo = new FileInfo { FilePath = "WordProcessing/four-pages.docx" } },
        new JoinItem { FileInfo = new FileInfo { FilePath = "WordProcessing/one-page.docx" } }
    },
    OutputPath = "Output/joined.docx"
};

var response = apiInstance.Join(new JoinRequest(options));
Console.WriteLine("Output file path: " + response.Path);

完整示例见 JoinMultipleDocuments.cs。

拆分文档

此示例将第 3、6 和 8 页拆分为单独的文档。

using System.Collections.Generic;
using GroupDocs.Merger.Cloud.Sdk.Api;
using GroupDocs.Merger.Cloud.Sdk.Client;
using GroupDocs.Merger.Cloud.Sdk.Model;
using GroupDocs.Merger.Cloud.Sdk.Model.Requests;
using FileInfo = GroupDocs.Merger.Cloud.Sdk.Model.FileInfo;

var config = new Configuration("YourClientId", "YourClientSecret");
config.ApiBaseUrl = "https://api.groupdocs.cloud";
var apiInstance = new DocumentApi(config);

var options = new SplitOptions
{
    FileInfo = new FileInfo { FilePath = "WordProcessing/sample-10-pages.docx" },
    OutputPath = "Output/split-document",
    Pages = new List<int?> { 3, 6, 8 },
    Mode = SplitOptions.ModeEnum.Pages
};

var response = apiInstance.Split(new SplitRequest(options));

foreach (var document in response.Documents)
{
    Console.WriteLine("Output file path: " + document.Path);
}

完整示例见 SplitToSinglePages.cs。

旋转页面

此示例将第 2 页和第 4 页旋转 90 度。

using System.Collections.Generic;
using GroupDocs.Merger.Cloud.Sdk.Api;
using GroupDocs.Merger.Cloud.Sdk.Client;
using GroupDocs.Merger.Cloud.Sdk.Model;
using GroupDocs.Merger.Cloud.Sdk.Model.Requests;
using FileInfo = GroupDocs.Merger.Cloud.Sdk.Model.FileInfo;

var config = new Configuration("YourClientId", "YourClientSecret");
config.ApiBaseUrl = "https://api.groupdocs.cloud";
var apiInstance = new PagesApi(config);

var options = new RotateOptions
{
    FileInfo = new FileInfo { FilePath = "Pdf/ten-pages.pdf" },
    OutputPath = "Output/rotate-pages.pdf",
    Pages = new List<int?> { 2, 4 },
    Mode = RotateOptions.ModeEnum.Rotate90
};

var response = apiInstance.Rotate(new RotateRequest(options));
Console.WriteLine("Output file path: " + response.Path);

完整示例见 RotatePages.cs。

获取支持的文件类型

获取 merger API 接受的格式。

using GroupDocs.Merger.Cloud.Sdk.Api;
using GroupDocs.Merger.Cloud.Sdk.Client;

var config = new Configuration("YourClientId", "YourClientSecret");
config.ApiBaseUrl = "https://api.groupdocs.cloud";
var apiInstance = new InfoApi(config);

var response = apiInstance.GetSupportedFileFormats();

foreach (var entry in response.Formats)
{
    Console.WriteLine($"{entry.FileFormat}: {string.Join(",", entry.Extension)}");
}

完整示例见 GetSupportedFileTypes.cs。

GitHub 上的示例

GroupDocs.Merger Cloud .NET Examples 仓库包含可直接运行的示例,涵盖:

CategoryExamples
合并多个文档、图像、跨格式、选定页面
拆分单页、页面范围
页面旋转、移动、交换、删除、提取、更改方向
安全添加、检查、更新和删除文档密码
Info文档信息、支持的文件类型

如何运行示例

  1. 克隆或下载 示例仓库
  2. 在 Visual Studio 2017 或更高版本中打开 Examples/GroupDocs.Merger.Cloud.Examples.CSharp.sln
  3. 右键单击解决方案并选择 Enable NuGet Package Restore
  4. 编辑 Examples/GroupDocs.Merger.Cloud.Examples.CSharp/RunExamples.cs,设置 Common.ClientId 和 Common.ClientSecret
  5. 生成并运行

更多细节请参阅 Getting Started。


Product Docs Swagger Examples Blog Support Dashboard


标签

Document Merging API | .NET Cloud API | GroupDocs.Merger Cloud | REST API | Page Manipulation | Document Security | Password Protection | Cloud Storage Integration | File Operations | Folder Operations | Document Splitting | PDF Merging | Cross-format Merging | Word Document Merging | Excel File Merging | Presentation Merging | Document Reorganization | API Explorer | Comprehensive Documentation | Multi-Platform Support | Secure API Access | GitHub Repository | Data Encryption | Client ID and Secret | Scalable Infrastructure | Fast Processing | Document Joining | Content Management | Customizable Document Processing | Document Manipulation API | Real-time API Integration | Merge Multiple Formats | Portable Document Format | OpenDocument Formats | Cross-platform API


 简体中文