Unisci file EPS in PDF tramite .NET

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

Aspose.Page per .NET EPS Merger consente di unire file Encapsulated PostScript (EPS) a documenti PDF utilizzando qualsiasi linguaggio supportato dalla piattaforma .NET: C#, VB, J#.
Per eseguire l’unione EPS è necessario eseguire diversi passaggi:

  1. Creare un’istanza di PsDocument passando il percorso del primo file EPS al suo costruttore, che carica il contenuto EPS per l’unione.
  2. Definire un array di stringhe contenente i percorsi dei file EPS aggiuntivi da unire, ad esempio string[] epsFiles = { "second.eps", "third.eps" };.
  3. Creare un’istanza di PdfSaveOptions, impostare AdditionalFontsFolder sulla cartella con i font personalizzati e, facoltativamente, impostare SuppressError = true per raccogliere gli errori non critici.
  4. Chiama document.AddPage(epsFiles); (o usa il metodo di unione appropriato) e poi document.Save("merged.pdf", pdfSaveOptions); per produrre un singolo PDF.
  5. Quando SuppressError è true, tutti gli avvisi vengono memorizzati in document.Exceptions; puoi iterare questa raccolta dopo aver salvato per esaminare i problemi.


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

 1// Merge several EPS files to one PDF document.
 2
 3// Initialize PS document with the first EPS file
 4PsDocument document = new PsDocument(DataDir + "input.eps");
 5
 6// Create an array of PostScript files that will be merged with the first one
 7string[] filesForMerge = new string[] { DataDir + "input2.eps", DataDir + "input3.eps" };
 8
 9// If you want to convert Postscript file despite of minor errors set this flag
10bool suppressErrors = true;
11
12//Initialize options object with necessary parameters.
13PdfSaveOptions options = new PdfSaveOptions(suppressErrors);
14// If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
15options.AdditionalFontsFolders = new string[] { @"{FONT_FOLDER}" };
16
17// Default page size is 595x842 and it is not mandatory to set it in SaveOptions
18// But if you need to specify the page size following line
19//PdfSaveOptions options = new PdfSaveOptions(suppressErrors, new Aspose.Page.Drawing.Size(595, 842));
20
21document.MergeToPdf(OutputDir + "outputPDF_out.pdf", filesForMerge, options);
22
23//Review errors
24if (suppressErrors)
25{
26    foreach (Exception ex in options.Exceptions)
27    {
28        Console.WriteLine(ex.Message);
29    }
30}
Example-MergeEPStoPDF.cs hosted with ❤ by GitHub

Vedi Fusione EPS in Java e C++.

Consideriamo PdfSaveOptions. Utilizzando questa classe possiamo assegnare diversi parametri di conversione durante la fusione di 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.