HTML JPG PDF XML DOCX
  Product Family
PDF

通过 .NET SDK 向 PDF 添加页脚

使用 Aspose.PDF Cloud .NET SDK 向 PDF 文档添加页脚的 API

Get Started

在 .NET 中最受欢迎的页脚操作

如何使用 Cloud .NET SDK 在 PDF 文档中处理页脚

为了在 PDF 文档中添加页脚,我们将使用 Aspose.PDF Cloud .NET SDK 此云 SDK 可帮助 .NET 程序员使用 C#, ASP.NET 或其他 .NET 语言为各种云平台开发基于云的 PDF 创建器、注释器、编辑器和转换器应用程序。打开 NuGet 包管理器,搜索 Aspose.PDF Cloud 并安装。您还可以在包管理器控制台中使用以下命令。 そしてインストールします。パッケージ マネージャー コンソールから以下のコマンドを使用することもできます。

包管理器控制台命令


     
    PM> Install-Package Aspose.Pdf-Cloud
     

通过 .NET 在 PDF 页脚中添加图像的步骤

Aspose.PDF Cloud .NET 开发人员可以轻松地在 PDF 文档的页脚中附加图像。开发人员只需几行代码。

  1. 使用您的应用程序密钥和秘密创建一个新的配置对象
  2. 创建一个对象以连接到云 API
  3. 上传您的文档文件
  4. 上传您的本地图像文件到页脚。
  5. 准备页脚设置。
  6. 调用 API 添加页脚。
  7. 检查响应并记录结果。
  8. 下载更新的文件以供本地使用。
 

此示例代码展示了如何使用 PDF Cloud .NET SDK 在 PDF 文档的页脚中添加图像


    using Aspose.Pdf.Cloud.Sdk.Api;
    using Aspose.Pdf.Cloud.Sdk.Model;

    namespace Footers
    {
        public class FootersAddImage
        {
            public static async Task Append(string documentName, string outputName, string imageFileName, int startPage, int endPage, string localFolder, string remoteFolder)
            {
		// Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required). 
		pdfApi = new PdfApi(AppSecret, AppSid);

                using (var file = File.OpenRead(Path.Combine(localFolder, documentName)))
		{ // Upload the local PDF to cloud storage folder name.
                    FilesUploadResult uploadResponse = await pdfApi.UploadFileAsync(Path.Combine(remoteFolder, documentName), documentName);
                    Console.WriteLine(uploadResponse.Uploaded[0]);
                }

                using (var file = File.OpenRead(Path.Combine(localFolder, imageFileName)))
		{ // Upload the local image file to cloud storage folder name.
                    FilesUploadResult uploadResponse = await pdfApi.UploadFileAsync(Path.Combine(remoteFolder, imageFileName), imageFileName);
                    Console.WriteLine(uploadResponse.Uploaded[0]);
                }

                // Create new Image Footer with input parameters for the PDF on cloud storage.
                ImageFooter footer = new ImageFooter(
                    Background: true,
                    LeftMargin: 1,
                    RightMargin: 2,
                    HorizontalAlignment: HorizontalAlignment.Center,
                    Opacity: 1,
                    Rotate: Rotation.None,
                    RotateAngle: 0,
                    XIndent: 0,
                    YIndent: 0,
                    Zoom: 1,
                    Width: 24,
                    Height: 24,
                    FileName: Path.Combine(remoteFolder, imageFileName)
                );

                // Append new Image Footer in the PDF on cloud storage.
                AsposeResponse response = await pdfApi.PostDocumentImageFooterAsync(documentName, footer, startPage, endPage, folder: remoteFolder);

                // Checks the response and logs the result.
                if (response == null)
                    Console.WriteLine("FootersAddImage(): Unexpected error!");
                else if (response.Code < 200 || response.Code > 299)
                    Console.WriteLine("FootersAddImage(): Failed to append image footer to the document.");
                else
                { // Downloads the updated file for local use.
                    Console.WriteLine("FootersAddImage(): image footer successfully appended to the document '{0}'.", documentName);
                    Stream stream = pdfApi.DownloadFile(Path.Combine(remoteFolder, documentName));
                    using var fileStream = File.Create(Path.Combine(localFolder, "append_image_footer_" + outputName));
                    stream.Position = 0;
                    await stream.CopyToAsync(fileStream);
                    Console.WriteLine("FootersAddImage(): File '{0}' successfully downloaded.", "append_image_footer_" + outputName);
                }
            }
        }
    }
 

通过 .NET SDK 处理页脚

在 PDF 页脚中添加图像可以增强文档的品牌、安全性、美观性和功能性。对于商业文件、报告、法律文件和营销材料尤为有价值,确保专业和结构良好的展示。 使用 Aspose.PDF Cloud .NET SDK 将页脚添加到 PDF 文档中。

使用我们的 .NET SDK,您可以

  • 以文本或图像格式添加 PDF 文档的页眉和页脚。
  • 向 PDF 文档添加表格和文本或图像印章。
  • 将多个 PDF 文档附加到现有文件中。
  • 处理 PDF 附件、注释和表单字段。
  • 对 PDF 文档应用加密或解密并设置密码。
  • 从页面或整个 PDF 文档中删除所有印章和表格。
  • 根据 ID 从 PDF 文档中删除特定的印章或表格。
  • 替换 PDF 页面或整个文档中的单个或多个文本实例。
  • 广泛支持将 PDF 文档转换为多种其他文件格式。
  • 提取 PDF 文件的各种元素并优化 PDF 文档。
  • 您可以尝试我们的免费应用来测试功能。

  •