Unisci file EPS in PDF utilizzando Java

Puoi verificare la qualità di Aspose.Page EPS Merger e visualizzare i risultati tramite EPS Merger online gratuito

Aspose.Page per Java EPS Merger consente di unire file Encapsulated PostScript (EPS) a documenti PDF su qualsiasi sistema operativo che supporti Java Virtual Machine.
Per eseguire l’unione di file EPS in PDF sono necessari diversi passaggi:

  1. Creare un’istanza di PsDocument dal primo file EPS.
  2. Creare un array di file EPS che verranno uniti al primo. 3. Utilizzare PdfSaveOptions per specificare i valori booleani AdditionalFontsFolder e SuppressError.
  3. Unire i file EPS al documento creato e salvarlo in PDF con le opzioni di salvataggio PDF.
  4. Se il valore SuppressErrors è impostato su true, come predefinito, è possibile visualizzare gli errori generati durante l’unione dei file EPS in un documento PDF e salvati nell’elenco Eccezioni.


Il seguente frammento di codice mostra come unire i file EPS in un documento PDF in Java:

 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}

Vedi Unione EPS in .NET e C++.

Consideriamo PdfSaveOptions. Utilizzando questa classe possiamo assegnare diversi parametri di conversione durante l’unione di file EPS in PDF.

Valuta l’unione di EPS online sul nostro EPS Merger.

Puoi scaricare esempi e file di dati da GitHub.

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.