Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-gists/fd34ec121f0d3c57891aa4acd623c7d4 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/fd34ec121f0d3c57891aa4acd623c7d4 to your computer and use it in GitHub Desktop.
Aspose.Page for Python gists for Landing
# Initialize PsDocument with the input PostScript file
document = PsDocument(data_dir + "inputForImage.ps")
#Initialize options object with necessary parameters.
options = ImageSaveOptions(aspose.page.drawing.imaging.ImageFormat.PNG)
# Save PS document as array of image bytes, one bytes array for one page.
images_bytes = document.save_as_image(options)
# Initialize PsDocument with the input PostScript file.
document = PsDocument(data_dir + "input.ps")
# If you want to convert Postscript file despite of minor errors set this flag
suppress_errors = True
#Initialize options object with necessary parameters.
options = PdfSaveOptions(suppress_errors)
# Save document as PDF
document.save_as_pdf(data_dir + "outputPDF_out.pdf", options)
#Load XPS document form the file
document = XpsDocument(data_dir + "input.xps", XpsLoadOptions())
# Initialize options object with necessary parameters.
options = JpegSaveOptions()
# Save XPS document to the images byte arrays. The first dimension is for inner documents
# and the second one is for pages within inner documents.
imagesBytes = document.save_as_image(options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment