Unisci file EPS in PDF usando C++

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

Aspose.Page per C++ EPS Merger consente di unire file Encapsulated PostScript (EPS) a documenti PDF su Windows e Linux.
Per eseguire l’unione 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 (tramite MergeToPdf) i file EPS con il 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 file EPS in un documento PDF in C++:

 1    // The path to the documents directory.
 2    System::String dataDir = RunExamples::GetDataDir_WorkingWithDocumentMerging();
 3    
 4    // Initialize PS document with the first PostScript file
 5    System::SharedPtr<PsDocument> document = System::MakeObject<PsDocument>(dataDir + u"input.eps");
 6    
 7    // Create an array of PostScript files that will be merged with the first one
 8    System::ArrayPtr<System::String> filesForMerge = System::MakeArray<System::String>({dataDir + u"input2.eps", dataDir + u"input3.eps"});
 9    
10    // If you want to convert Postscript file despite of minor errors set this flag
11    bool suppressErrors = true;
12    
13    //Initialize options object with necessary parameters.
14    System::SharedPtr<PdfSaveOptions> options = System::MakeObject<PdfSaveOptions>(suppressErrors);
15    // If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.
16    options->set_AdditionalFontsFolders(System::MakeArray<System::String>({u"{FONT_FOLDER}"}));
17    
18    // Default page size is 595x842 and it is not mandatory to set it in SaveOptions
19    // But if you need to specify the page size following line
20    //PdfSaveOptions options = new PdfSaveOptions(suppressErrors, new Aspose.Page.Drawing.Size(595, 842));
21    
22    document->MergeToPdf(dataDir + u"outputPDF_out.pdf", filesForMerge, options);
23    
24    //Review errors
25    if (suppressErrors)
26    {
27        for (auto&& ex : System::IterateOver(options->get_Exceptions()))
28        {
29            System::Console::WriteLine(ex->get_Message());
30        }
31    }

Vedi Unione EPS in .Net e Java.

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