If so you can download any of the below versions for testing. The product will function as normal except for an evaluation limitation. At the time of purchase we provide a license file via email that will allow the product to work in its full capacity. If you would also like an evaluation license to test without any restrictions for 30 days, please follow the directions provided here.
If you experience errors, when you try to download a file, make sure your network policies (enforced by your company or ISP) allow downloading ZIP and/or MSI files.
Download Aspose.Page for Python via .NET for PS and XPS File Manipulation
Aspose.Page for Python via .NET, The PS, EPS, and XPS files Processing API enables developers to work with PDF documents without relying on Microsoft Office® or Adobe® products installed.
You can easily use Aspose.Page for Python via .NET from
pip with the following command.
Product Page | Docs | Demos | Blog | Code Samples | Free Support | Temporary License | EULA
Aspose.Page for Python is a Python API that can be used to add XPS manipulation capabilities to your own applications. The API also supports the conversion of XPS, EPS, and PS documents to other formats.
Why download Aspose.Page for Python?
Developers can perform various operations on XPS documents, such as, add text, images, pages, gradient, grid using the visual brush, transparency object and set opacity mask. It allows you to create, edit and convert the file pages as well as the ability to manipulate documents and elements, create vector graphics, group shapes, and specifying colors in different color spaces including sRGB, scRGB, and any space-based on ICC profile.
General XPS, EPS & PS Processing Features
- Creation & edition of documents via API.
- Manipulation with pages.
- Manipulation with graphics objects and graphics states.
- Support for various types of painting and colorspaces.
- Manipulation with print tickets in XPS documents.
- Support for cross-package operations in XPS document.
- Convert XPS, PS & EPS documents to other popular formats.
- Merge documents to PDF.
- Resize and crop EPS files.
- Convert raster images to EPS files.
Supported PostScript and XPS versions
- Supports PostScript language levels 1-3 with an exception of font types: Type2 (CFF), Type14 (Chameleon), Types 9, 10, 11.
- Supports XPS and OXPS formats in the latest versions.
Conversion Features
XPS, EPS, PS
Save XPS Documents As
Fixed Layout: PDF, PS
Image: BMP, TIFF, JPEG, PNG
Save PS & EPS Documents As
Fixed Layout: PDF
Metafiles: EMF, WMF
Image: BMP, TIFF, JPEG, PNG
Package Features
- Create & modify XPS documents.
- Create new PS/EPS documents. Editing will be added soon.
- Add pages to PS and XPS documents.
- Manipulate graphics states, applying transformations and clipping to the group of visual objects.
- Add vector graphic shapes (Path element) and text strings (Glyphs element) to PS/EPS and XPS documents.
- Support for Unicode strings.
- Group various elements as well as modify the appearance of text strings and graphics.
- Support for visual brush, image brush, solid color brush, and more in XPS documents.
- Support for full transparency in XPS documents.
- Support for solid, hatch, texture and gradient (linear and path) painting and stroking in PS and EPS files.
- Support for pseudo-transparency and translucent images in PS/EPS documents.
- Work with multiple documents within an XPS document.
- Preserve print tickets and add default print tickets to new XPS documents.
- Perform cross-package operations such as inserting a page from another XPS document.
- Conversion of XPS, PS & EPS documents to raster images and PDF.
- Merging of XPS documents to PDF and XPS.
- Merging of PS documents to PDF.
The following table indicates the file formats that Aspose.Page for Python can load and Save.
Format | Description | Load | XPS Save | EPS/PS Save | Remarks |
---|
XPS | XML Paper Specification File | Yes | Yes | No | |
EPS | Encapsulated PostScript File | Yes | No | Yes | |
PS | PostScript File | Yes | No | Yes | |
PDF | Portable Document Format | No | Yes | Yes | |
BMP | Bitmap Image Format | No | Yes | Yes | |
TIFF | Tagged Image File Format | No | Yes | Yes | |
JPEG | Image Format | No | Yes | Yes | |
PNG | Image Format | No | Yes | Yes | |
Aspose.Page for Python can be used to develop 32-bit and 64-bit Python applications for Windows where Python 3.6 or later is installed. Packages for Linux and MacOS will be released in the nearest future.
Get Started
Run pip install aspose-page
to fetch the package. If you already have Aspose.Page for Python and want to get the latest version, please run pip install --upgrade aspose-page
.
To learn more about Aspose.Page for Python and explore the basic requirements and features of the library, check out the following Aspose.Page Documentation pages for other use cases.
Create a PostScript file from scratch in Python
In the next code snippet, we are creating a PS document from scratch containing the text “Hello from Aspose!”. After installing Aspose.Page for Python in your environment, you can execute below code sample to see how Aspose.Page API works.
Below code snippet follows these steps:
- Instantiate a
PsSaveOptions
object. - Create PostScript file output stream.
- Instantiate a
PsDocument
object. - Create
aspose.pydrawing.Font
using aspose.page.ExternalFontCache
. - Fill text with solid brush.
- Save the resultant PostScript file.
The following code snippet is a “Hello, World!” program to show main technique of Aspose.Page for Python in PS files:
from aspose.page.eps import *
from aspose.page.eps.device import *
import aspose.pydrawing *
#Create save options
options = PsSaveOptions()
#Create output stream for PS document
out_ps_stream = open(dir + "document.ps", "wb")
#Create PS document
document = PsDocument(out_ps_stream, options, false)
#Create aspose.pydrawing.Font
font = aspose.page.ExternalFontCache.create_font_by_family_name("Times New Roman", font_size, aspose.pydrawing.FontStyle.BOLD)
# Add text fragment to new page at point (50, 150)
document.fill_text("Hello from Aspose!", font, 50, 150, aspose.pydrawing.SolidBrush(aspose.pydrawing.Color.blue))
#Close current page
document.close_page()
#Save the document
document.save()
Create an XPS file from scratch in Python
In the next code snippet, we are creating an empty XPS document containing the text �Hello from Aspose!�.
Below code snippet follows these steps:
- Instantiate a
XpsDocument
object. - Create ‘XpsGlyphs
object with using the insatnce of
XpsDocument`. - Set painting for the glyphs object.
- Create
aspose.pydrawing.Font
using aspose.page.ExternalFontCache
. - Save the resultant XPS document.
The following code snippet is a “Hello, World!” program to show main technique of Aspose.Page for Python in PS files:
from aspose.page.xps import *
import aspose.pydrawing *
#Create new XPS Document
x_docs = XpsDocument()
#Add glyph to the document
glyphs = x_docs.add_glyphs("Arial", 12, aspose.pydrawing.FontStyle.REGULAR, 300, 450, "Hello World!")
#Set painting for glyphs
glyphs.fill = x_docs.create_solid_color_brush(aspose.pydrawing.Color.black)
#Save result
x_docs.save(dir + "output.xps")
Example of converting EPS to JPEG
Aspose.Page for Python is a PS/EPS and XPS manipulation API that lets you convert any existing EPS file to JPEG or other raster image formats.
Below code snippet follows these steps:
- Create EPS file input stream.
- Initialize
PsDocument
object. - Create
ImageSaveOptions
object. - Initialize
ImageDevice
object with JPEG aspose.pydrawing.imaging.ImageFormat
. - Save the document.
import os
import aspose
from aspose.page.eps import *
from aspose.page.eps.device import *
import aspose.pydrawing.imaging *
#Initialize EPS input stream
eps_stream = open(data_dir + "input.eps", "rb")
#Create PsDocument
document = PsDocument(ps_stream)
#If you want to convert Postscript file despite of minor errors set this flag
suppress_errors = True
#Initialize options object with necessary parameters.
options = ImageSaveOptions(suppress_errors)
#Default image format is PNG and it is not mandatory to set it in ImageDevice
#Default image size is 595x842 and it is not mandatory to set it in ImageDevice
device = ImageDevice(aspose.pydrawing.imaging.ImageFormat.jpeg)
#Save document to JPEG image
document.save(device, options)
Example of converting XPS to PDF
Aspose.Page for Python supports the feature to convert XPS documents to PDF format. To accomplish this requirement, the PdfSaveOptions class has been introduced into the aspose.page.xps.presentation.pdf namespace. Instantiate an object of PdfSaveOptions and pass it as a second argument to the XpsDocument.save(..) method.
Below code snippet follows these steps:
- Create a PDF file output stream.
- Create an XPS document input stream.
- Instantiate
XpsDocument
class with the XPS input stream. - Create
PdfSaveOptions
object with needed settings. - Initialize
PdfDevice
with PDF ouputStream - Call the
XpsDocument.save()
method and pass it PdfDevice and PdfSaveOptions objects convert the XPS document to PDF.
from aspose.page.xps import *
from aspose.page.xps.presentation.pdf import *
#Initialize PDF output stream
pdf_stream = open(data_dir + "XPStoPDF_out.pdf", "wb")
#Initialize XPS input stream
xps_stream = open(data_dir + "input.xps", "rb")
#Load XPS document form the stream
document = XpsDocument(xps_stream, XpsLoadOptions())
#or load XPS document directly from file. No xpsStream is needed then.
#XpsDocument document = new XpsDocument(inputFileName, new XpsLoadOptions());
#Initialize options object with necessary parameters.
options = PdfSaveOptions()
options.jpeg_quality_level = 100
options.image_compression = PdfImageCompression.JPEG
options.text_compression = PdfTextCompression.FLATE
options.page_numbers = [ 1, 2, 6 ]
#Create rendering device for PDF format
device = PdfDevice(pdf_stream)
#Save XPS document as PDF
document.save(device, options)
Merge XPS Files
Merge multiple XPS into single file in Python with Aspose.Page programmatically. XPS files are merged such that the first one is joined at the end of the other document.
Below code snippet follows these steps:
- Create a XPS file output stream.
- Create the first XPS document input stream.
- Instantiate
XpsDocument
class with the XPS input stream. - Call the
XpsDocument.merge()
method and pass it files to merge and the output XPS stream.
from aspose.page.xps import *
#Initialize XPS output stream
out_stream = data_dir + "mergedXPSfiles.xps", "wb")
#Initialize XPS input stream
out_stream = open(data_dir + "input.xps", "rb")
#Load XPS document from the stream
document = XpsDocument(in_stream, XpsLoadOptions())
#or load XPS document directly from file. No xpsStream is needed then.
#XpsDocument document = new XpsDocument(inputFileName, new XpsLoadOptions());
#Create an array of XPS files that will be merged with the first one
files_to_merge = [ data_dir + "Demo.xps", data_dir + "sample.xps" ]
# Merge XPS files to output PDF document
document.merge(files_to_merge, out_stream)
Crop EPS image
Crop EPS image without using specialized software. EPS file doesn’t loss initial content. It just have bounding box changed.
Below code snippet follows these steps:
- Create EPS file input stream.
- Initialize
PsDocument
object. - Create output EPS stream.
- Call
PsDocument.crop_eps()
method and pass it the output stream and new bounding box, defined by for numbers.
from aspose.page.eps import *
#Create an input stream for EPS file
input_eps_stream = open(data_dir + "input.eps", "rb")
#Initialize PsDocument object with input stream
doc = PsDocument(input_eps_stream)
#If someone whants to know initial bounding box, get initial bounding box of EPS image
#initial_bounding_box = doc.extract_eps_bounding_box()
#Create an output stream for resized EPS
input_eps_stream = open(data_dir + "output_crop.eps", "wb")
#Create new bounding box
#Bounding box is represented by 4 numbers: x0, y0, x, y, where x0 - left margin, y0 - top margin, x - (x0 + width), y - (y0 + height)
new_bounding_box = [ 260, 300, 480, 432 ]
#Crop EPS image and save it to the output stream.
doc.crop_eps(output_eps_stream, new_bounding_box)
This wheel contains Aspose.Page version 24.9.0, compatible with Python 3, and optimized for Windows 64-bit systems (AMD64).
Added:
Downloads:
It contains Aspose.Page for Python via .NET 24.9.0, Windows x32 release.
Added:
Downloads:
This wheel contains Aspose.Page version 24.7.0, compatible with Python 3, and optimized for Windows 64-bit systems (AMD64).
Added:
Downloads:
It contains Aspose.Page for Python via .NET 24.7.0, Windows x32 release.
Added:
Downloads:
This wheel contains Aspose.Page version 24.6.0, compatible with Python 3, and optimized for Windows 64-bit systems (AMD64).
Added:
Downloads:
It contains Aspose.Page for Python via .NET 24.6.0, Windows x32 release.
Added:
Downloads:
This wheel contains Aspose.Page version 24.2.0, compatible with Python 3, and optimized for Windows 64-bit systems (AMD64).
Added:
Downloads:
It contains Aspose.Page for Python via .NET 24.2.0, Windows x32 release.
Added:
Downloads:
This wheel contains Aspose.Page version 24.1.0, compatible with Python 3, and optimized for Windows 64-bit systems (AMD64).
Added:
Downloads:
It contains Aspose.Page for Python via .NET 24.1.0, Windows x32 release.
Added:
Downloads: