使用 Node.js REST API 将 TIFF 转换为 PDF

在本主题中,您将学习如何使用 Node.js REST API 将 TIFF 转换为 PDF。我们将遵循以下章节中详细清晰的步骤,使用 Node.js Low Code API 开发一个 TIFF 转 PDF 转换器。此应用程序可以与 Windows、Linux 或 macOS 环境中支持的任何 Node.js 应用程序集成,并且转换过程免费。

先决条件

使用 Node.js REST API 将 TIFF 转换为 PDF 的步骤

  1. 设置 API 的客户端 ID 和客户端密钥以将 TIFF 转换为 PDF
  2. 使用客户端凭据创建 ImagingAPI 类的实例来执行 TIFF 到 PDF 的转换
  3. 指定源 TIFF 和输出 PDF 文件名
  4. 读取源 TIFF 文件并将其上传到云存储
  5. 使用输入文件流和输出 PDF 格式创建 ConvertImageRequest 实例
  6. 调用 图像转换 方法使用 Node.js REST API 将 TIF 转换为 PDF
  7. 将输出的 PDF 文件与返回的响应流一起保存在本地磁盘上

上述步骤使用 Node.js Low Code API 将文件类型从 TIFF 转换为 PDF。我们将首先通过创建 ImagingAPI 类对象来初始化 SDK 的配置。然后,我们将使用 FileStream 加载源 TIFF 文件,并实例化 ConvertImageRequest 类对象,该对象随后将使用 ConvertImage() 方法将其转换为 PDF。

Node.js Low Code API 中 TIFF 到 PDF 转换的代码

此示例代码可帮助您使用 Node.js Cloud API 将 *TIFF 转换为 PDF。您需要借助 Aspose.Imaging REST API SDK 提供一个 TIFF 文件,然后下载输出的 PDF 文件流并将其保存到本地。您可以通过在 ConvertImageRequest 对象实例化期间设置属性来增强转换过程,在此示例代码中,这些属性默认设置为 null。

In this tutorial, we have learned to transform TIFF to PDF with Cloud API. If you are interested in performing JPEG to PDF conversion, refer to the article on how to Convert JPG to PDF with Node.js REST API.

 简体中文