HTML JPG PDF XML DOCX
  Product Family
PDF

通过 .NET SDK 在 PDF 页脚中添加文本

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

Get Started

如何使用云 .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. 调用 API 以添加页脚。
  5. 检查响应并记录结果。
  6. 下载更新的文件以供本地使用。
 

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


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

    namespace Footers
    {
        public class FootersAddText
        {
            public static async Task Append(string documentName, string outputName, string footerText, 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]);
                }

                // Create new Text Footer with input parameters for the PDF on cloud storage.
                TextFooter footer = new TextFooter(
                    Background: true,
                    LeftMargin: 1,
                    RightMargin: 2,
                    HorizontalAlignment: HorizontalAlignment.Center,
                    Opacity: 1,
                    Rotate: Rotation.None,
                    RotateAngle: 15,
                    XIndent: 0,
                    YIndent: 0,
                    Zoom: 1,
                    Value: footerText
                );

                // Append new Text Footer in the PDF on cloud storage.
                AsposeResponse response = await pdfApi.PostDocumentTextFooterAsync(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("FootersAddText(): Failed to append text footer to the document.");
                else
                { // Downloads the updated file for local use.
                    Console.WriteLine("FootersAddText(): text footer '{0}' successfully appended to the document '{1}'.", footerText, documentName);
                    Stream stream = pdfApi.DownloadFile(Path.Combine(remoteFolder, documentName));
                    using var fileStream = File.Create(Path.Combine(localFolder, "append_text_footer_" + outputName));
                    stream.Position = 0;
                    await stream.CopyToAsync(fileStream);
                    Console.WriteLine("FootersAddText(): File '{0}' successfully downloaded.", "append_text_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 文档优化。
  • 您可以尝试我们的免费应用来测试功能。

  •