Unisci file XPS | Aspose.Page per Java

È possibile verificare la qualità di Aspose.Page XPS Merger e visualizzare i risultati tramite lo strumento online gratuito XPS Merger

Aspose.Page Java XPS Merger consente di unire file XPS a un documento XPS su qualsiasi sistema operativo che supporti Java Virtual Machine.
Per eseguire l’unione XPS è necessario eseguire diversi passaggi:

  1. Creare un’istanza di XpsDocument dal primo file XPS.
  2. Creare un array di file XPS che verrà unito al primo.
  3. Unire i file XPS al documento creato e salvarlo.


Il seguente frammento di codice mostra come unire file XPS a 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// The path to the documents directory.
 3String dataDir = Utils.getDataDir();
 4// Load the first XPS file in a document
 5XpsDocument document = new XpsDocument(dataDir + "input.xps");
 6
 7// Create an array of XPS files that will be merged with the first one
 8String[] filesForMerge = new String[] { dataDir + "Demo.xps", dataDir + "sample.xps" };
 9
10//merge and save to output XPS file
11document.merge(filesForMerge, dataDir + "mergedXPSfiles.xps");

Vedere “Unione XPS” in .NET e C++.

Il modulo di fusione XPS di Aspose.Page in Java consente anche di unire file XPS a un documento PDF.
Per eseguire l’unione XPS in PDF sono necessari diversi passaggi:

  1. Creare un’istanza di XpsDocument dal primo file XPS.
  2. Creare un array di file XPS che verranno uniti al primo. 3. Specificare TextCompression, ImageCompression, JpegQualityLevel e altre opzioni di PdfSaveOptions.
  3. Unire i file XPS al documento creato e salvarlo in PDF con le opzioni di salvataggio PDF.


Il seguente frammento di codice mostra come unire i file XPS a 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// The path to the documents directory.
 3String dataDir = Utils.getDataDir();
 4
 5// Load the first XPS file in a document
 6XpsDocument document = new XpsDocument(dataDir + "input.xps");
 7
 8// Create an array of XPS files that will be merged with the first one
 9String[] filesForMerge = new String[] { dataDir + "Demo.xps", dataDir + "sample.xps" };
10
11// Initialize options object with necessary parameters.
12com.aspose.xps.rendering.PdfSaveOptions options = new com.aspose.xps.rendering.PdfSaveOptions();
13options.setJpegQualityLevel(100);
14options.setImageCompression(com.aspose.xps.rendering.PdfImageCompression.Jpeg);
15options.setTextCompression(com.aspose.xps.rendering.PdfTextCompression.Flate);
16options.setPageNumbers(new int[] { 1, 2, 6 });
17
18document.mergeToPdf(filesForMerge, dataDir + "XPStoPDF.pdf", options);

Vedi Unione XPS in .NET e C++.

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

Valuta l’unione di XPS online sul nostro XPS Meger.

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.