Javaを使用してEPSファイルをPDFに結合

Aspose.Page EPS Merger の品質をチェックし、無料のオンライン EPS Merger で結果を表示できます。

Aspose.Page for Java EPS Merger を使用すると、Java 仮想マシンが動作するあらゆる OS 上で、Encapsulated PostScript (EPS) ファイルを PDF ドキュメントに結合できます。
EPS ファイルを PDF に結合させるには、いくつかの手順を実行する必要があります。

  1. 最初の EPS ファイルから PsDocument のインスタンスを作成します。
  2. 最初のファイルと結合する EPS ファイルの配列を作成します。
  3. PdfSaveOptions を使用して、AdditionalFontsFolderSuppressError のブール値を指定します。
  4. 作成したドキュメントに EPS ファイルを結合し、PDF 保存オプションを使用して PDF として保存します。
  5. SuppressErrors の値が true(デフォルト)の場合、EPS ファイルを PDF ドキュメントに結合する際に発生したエラーを確認し、Exceptions リストに保存することができます。


次のコードスニペットは、Java で EPS ファイルを PDF ドキュメントに結合する方法を示しています。

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-Java
 2
 3// The path to the documents directory.
 4String dataDir = Utils.getDataDir();
 5
 6// Initialize PS document from EPS file.
 7PsDocument document = new PsDocument(dataDir + "input.eps");
 8
 9// Create an array of EPS files that will be merged with the first one
10String[] filesForMerge = new String[] { dataDir + "input2.eps", dataDir + "input3.eps" };
11
12// If you want to merge PostScript file despite of minor errors set this flag
13boolean suppressErrors = true;
14
15//Initialize options object with necessary parameters.
16PdfSaveOptions options = new PdfSaveOptions(suppressErrors);
17// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
18// options.setAdditionalFontsFolders(new String [] {"FONTS_FOLDER"});
19// Default page size is 595x842 and it is not mandatory to set it in PdfSaveOptions
20// But if you need to specify size use following line
21// PdfSaveOptions options = new PdfSaveOptions(suppressErrors, new Dimension(595, 842));
22
23// Merge EPS files with initialized PsDocument and save it as PDF
24document.mergeToPdf(dataDir + "mergePStoPDF.pdf", filesForMerge, options);
25
26//Review errors
27if (suppressErrors) {
28    for (Exception ex : options.getExceptions()) {
29        System.out.println(ex.getMessage());
30    }
31}

.NET および C++ の EPS マージを参照してください。

PdfSaveOptions について考えてみましょう。このクラスを使用すると、EPS ファイルを PDF に結合する際に、さまざまな変換パラメータを指定できます。

EPS Merger で、オンラインで EPS マージを評価できます。

サンプルとデータファイルは GitHub からダウンロードできます。

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.