Package: aspose-page
PS and XPS File Manipulation via Python APIProduct Page|Docs|Demos|API Reference|Examples|Blog|Search|Free Support|Temporary LicenseAspose.Page for Python via .NETis an on premise Python API that allows you to add PS/EPS and XPS manipulation features to your own applications. The API also supports converting XPS, EPS & PS documents to other formats.Developers can perform various operations on PS and XPS documents, such as, add text, images, pages, gradient, grid using the visual brush,transparency objectandset 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.XPS, EPS & PS Processing FeaturesCreate & modify XPS documents via API.Create PS & EPS documents via API.Add pages to PS & XPS documents.Create vector graphic shapes (Path element) and text strings (Glyphs element).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.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 document.Conversion of XPS, PS & EPS documents to other popular formats.Supports PostScript language levels 1-3 with an exception of font types: Type2 (CFF), Type14 (Chameleon), Types 9, 10, 11.Supported Read FormatsXPS, EPS, PSSave XPS Documents AsFixed Layout:PDFImage:BMP, TIFF, JPEG, PNGSave PS & EPS Documents AsMetafiles:EMF, WMFAnimation:GIFImage:BMP, TIFF, JPEG, PNGPlatform IndependenceAspose.Page for Python via .NET can be used to develop 32-bit and 64-bit Python applications for Windows where Python 3.5 or later is installed.Get StartedAre you ready to give Aspose.Page for Python a try? Simply executepip install aspose-pageto install wheel package package. If you already have Aspose.Page for Python and want to upgrade the version, please executepip install --upgrade aspose-pageto get the latest version.Create an XPS Document from Scratch via Python CodeExecute the below code snippet to see how Aspose.Page API performs in your own environment or check theGitHub Repositoryfor other common usage scenarios.# The path to the documents directory.dir=Util.get_data_dir_working_with_document()# Create new XPS Documentx_docs=XpsDocument()# add glyph to the documentglyphs=x_docs.add_glyphs("Arial",12,aspose.pydrawing.FontStyle.REGULAR,300,450,"Hello World!")glyphs.fill=x_docs.create_solid_color_brush(aspose.pydrawing.Color.black)# save resultx_docs.save(dir+"output.xps")Convert a PostScript (PS) File to PDF FormatAspose.Page for Python allows you to work with document conversion, such as; PS to images, PS to PDF, XPS to images, XPS to PDF and so on. The following snippet demonstrates the conversion of PS to PDF using streams:# The path to the documents directory.data_dir=Util.get_data_dir_working_with_document_conversion()# Initialize PDF output streampdf_stream=open(data_dir+"outputPDF_out.pdf","wb")# Initialize PostScript input streamps_stream=open(data_dir+"input.ps","rb",)document=PsDocument(ps_stream)# If you want to convert Postscript file despite of minor errors set this flagsuppress_errors=True#Initialize options object with necessary parameters.options=PdfSaveOptions(suppress_errors)# If you want to add special folder where fonts are stored. Default fonts folder in OS is always included.options.additional_fonts_folders=["""{FONT_FOLDER}"""]# Default page size is 595x842 and it is not mandatory to set it in PdfDevicedevice=PdfDevice(pdf_stream)# But if you need to specify size and image format use following line#Aspose.Page.EPS.Device.PdfDevice device = new Aspose.Page.EPS.Device.PdfDevice(pdfStream, new aspose.pydrawing.Size(595, 842));try:document.save(device,options)finally:ps_stream.close()pdf_stream.close()Product Page|Docs|Demos|API Reference|Examples|Blog|Search|Free Support|Temporary License