Created
June 22, 2024 01:15
-
-
Save aspose-com-kb/4c687305058d6c3c3f7eefdfb71944b5 to your computer and use it in GitHub Desktop.
Merge XPS Files in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aspose.page | |
from aspose.page.xps import * | |
from aspose.page.xps.presentation.pdf import * | |
with open("mergedXPSfilespy.pdf", "wb") as pdf_stream: | |
# Initialize XPS input stream | |
with open("input.xps", "rb") as xps_stream: | |
# Load XPS document form the stream | |
document = XpsDocument(xps_stream, XpsLoadOptions()) | |
# Initialize options object with necessary parameters. | |
options = PdfSaveOptions() | |
options.jpeg_quality_level = 100 | |
options.image_compression = PdfImageCompression.JPEG | |
options.text_compression = PdfTextCompression.FLATE | |
# Create PDF rendering device | |
device = PdfDevice(pdf_stream) | |
# Create an array to merge XPS files | |
files_to_merge = [ "input.xps", "input.xps" ] | |
# Merge XPS files to PDF format | |
document.merge(files_to_merge, device, options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment