使用 JavaScript 将 PS/EPS 文件合并为 PDF

您可以通过免费在线工具 PS 合并器EPS 合并器

检查 Aspose.Page PS/EPS 合并的质量并查看结果。

通过 C++ PS/EPS 合并器,Aspose.Page for JavaScript 允许在 Windows 和 Linux 系统上将封装的 PostScript (EPS) 文件合并为 PDF 文档。
执行 PS/EPS 到 PDF 合并需要执行以下步骤:

  1. 创建文件读取器“const file_reader = new FileReader();”并读取文件“file_reader.readAsArrayBuffer(e.target.files[0]);”。 2. 使用 AsposePagePrepare 加载所需文件
  2. 加载最后一个文件后,调用 AsposePSMergeToPdf,并将文件名数组、结果文件名和 SuppressError 布尔值传递给它。
  3. 结果 JSON 包含 fileNameResult 中的文件名。
  4. 如果 SuppressErrors 值为 true(默认情况下),则可以查看 EPS 合并为 PDF 时抛出的错误。
  5. 您可以使用 DownloadFile 函数下载文件:“DownloadFile(JSON.fileNameResult, “image/pdf”);”


以下代码片段展示了如何使用 JavaScript 将 EPS 文件合并为 PDF 文档:

 1  var fPs2Pdf = function (e) {
 2    const file_reader = new FileReader();
 3    function readFile(index) {
 4      if (index >= e.target.files.length) {
 5          const fileNames = Array.from(e.target.files).map((x) => x.name).toString();
 6          const JSON = PSMergeToPdf(fileNames, "ResultMerge.pdf", true);
 7          if (JSON.errorCode == 0) {
 8            DownloadFile(JSON.fileNameResult, "image/pdf");
 9          }
10          else 
11            document.getElementById('output').textContent = JSON.errorText;
12          return;
13      }
14      const file = e.target.files[index];
15      file_reader.onload = function (event) {
16        AsposePagePrepare(event.target.result, file.name);
17        readFile(index + 1)
18      }
19      file_reader.readAsArrayBuffer(file);
20    }
21    readFile(0);
22  }

请参阅 .NetJava 中的 PS/EPS 合并。

让我们来考虑一些参数。

在我们的 EPS 合并器 上在线评估 EPS 合并。

您可以从 GitHub 下载示例和数据文件。

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.