Skip to main content

Product Page | Documentation | Examples | Demos | Blog | API Reference | Search | Free Support | Temporary License

Try our Free Online Apps demonstrating some of the most popular Aspose.PDF functionality.

Aspose.PDF for Python via .NET is a Python wrapper that enables the developers to add PDF processing capabilities to their applications. It can be used to generate or read, convert and manipulate PDF files without the use of Adobe Acrobat. Aspose.PDF for Python via .NET allows to perform a range of document processing tasks such as form processing, get and set metadata information, text and page manipulation, management of annotations, add or remove bookmarks and watermarks, attachments, custom font handling and much more. Check out the Landing Pages of Aspose.PDF for Python via .NET for a more detailed description of the features and possibilities of the library.

General PDF Features

  • Supports most established PDF standards and PDF specifications.
  • Ability to read & export PDFs in multiple image formats including BMP, GIF, JPEG & PNG.
  • Set basic information (e.g. author, creator) of the PDF document.
  • Configure PDF Page properties (e.g. width, height, cropbox, bleedbox etc.).
  • Set page numbering, bookmark level, page sizes etc.
  • Ability to work with text, paragraphs, headings, hyperlinks, graphs, attachments etc.

Supported PDF versions

Aspose.PDF for Python via .NET supports PDF versions 1.2, 1.3, 1.4, 1.5, 1.6, 1.7 and 2.0.

Conversion Features

Aspose.PDF for Python via .NET library allows you to successfully, quickly and easily convert your PDF documents to the most popular formats and vice versa.

  • Convert PDF to Word, Excel, and PowerPoint.
  • Convert PDF to Images formats.
  • Convert PDF file to HTML format and vice versa.
  • Convert PDF to EPUB, Text, XPS, etc.
  • Convert EPUB, Markdown, Text, XPS, PostScript, XML, LaTex to PDF.

Package Features

  • Add, search, extract and replace text in PDF files.
  • Add/delete, extract and replace images.
  • Insert, delete, split PDF pages.
  • Set and get XMP metadata.
  • Validate (PDF/A-1a, PDF/A-1b).
  • Work with bookmarks, annotations, PDF forms, stamps, watermarks and more.

Supported File Formats

The following table indicates the file formats that Aspose.PDF for Python via .NET can load and Save.

Format Description Load Save Remarks
PDF Portable Document Format Yes Yes  
CGM Computer Graphics Metafile for 2D vector graphics Yes No  
EPUB Ebook file format Yes Yes  
HTML HTML Format Yes Yes  
TeX LaTex typesetting file format Yes Yes  
MHT MHTML Document Yes No  
PCL Printer Control Language Files Yes No  
PS Postscript Files Yes No  
SVG Scalable Vector Graphics (An XML-based vector image format) Yes Yes  
XML XML Format Yes Yes  
XPS XPS Documents Yes Yes  
XSLFO XSL-FO is part of XSL file which is used for the transformation and formatting of XML data Yes No  
MD Markdown Format Yes No  
XLS Saves the document in the Microsoft Excel SpreadSheet No Yes  
XLSX Saves the document in the Microsoft Excel 2007 format No Yes  
PPTX Saves the document in the Microsoft PowerPoint Presentations format No Yes  
DOC Saves the document in the Microsoft Word format No Yes  
DOCX Saves the document in the Microsoft Word format No Yes  
MobiXML Saves the document in eBook MobiXML Standard format No Yes  
JPEG Saves the document in JPEG Format Yes Yes  
EMF Enhanced metafile format (EMF) Yes Yes  
PNG Saves the document in PNG Format Yes Yes  
BMP Saves the document in BMP Format Yes Yes  
GIF Graphic Interchange Format No Yes  
TIFF Saves the document as Single or Multi-Page TIFF Image Yes Yes  
Text Save the document int Text Format Yes Yes  

Platform Independence

Aspose.PDF for Python via .NET can be used to develop 32-bit and 64-bit Python applications for different operating systems (such as Windows and Linux, macOS) where Python 3.9 or later is installed.

Get Started

Run pip install aspose-pdf to fetch the package. If you already have Aspose.PDF for Python via .NET and want to get the latest version, please run pip install --upgrade aspose-pdf.

If necessary, you can download Aspose.PDF for Python via .NET from releases.aspose.com and install it using the command pip install <path_to_whl>.

To learn more about Aspose.PDF for Python via .NET , including its basic requirements and features, please refer to the Aspose.PDF for Python via .NET Documentation or visit the GitHub repository.

Create a PDF file from scratch in Python

In the next code snippet, we are creating a PDF document fron scratch containing the text “Hello World!”. After installing Aspose.PDF for Python via .NET in your environment, you can execute below code sample to see how Aspose.PDF API works.

Below code snippet follows these steps:

  1. Instantiate a Document object.
  2. Add a Page to the document object.
  3. Create a TextFragment object.
  4. Add TextFragment to Paragraph collection of the page.
  5. Save the resultant PDF document.

The following code snippet is a “Hello, World!” program to exhibit working of Aspose.PDF for Python via .NET API:

import aspose.pdf as ap

# Initialize document object
document = ap.Document()
# Add page
page = document.pages.add()
# Initialize textfragment object
text_fragment = ap.text.TextFragment("Hello,world!")
# Add text fragment to new page
page.paragraphs.add(text_fragment)
# Save updated PDF
document.save("output.pdf")

Example of converting HTML to PDF

Aspose.PDF for Python via .NET is a PDF manipulation API that lets you convert any existing HTML documents to PDF format. The process of converting HTML to PDF can be flexibly customized.

Below code snippet follows these steps:

  1. Create an instance of the HtmlLoadOptions object.
  2. Initialize Document object.
  3. Save output PDF document by calling Document.Save() method.
import aspose.pdf as ap
# Instantiate an object of HtmlLoadOptions
options = ap.HtmlLoadOptions()
# Convert HTML to PDF
document = ap.Document("input.html", options)
# Save PDF
document.save("output.pdf")

Example of converting PDF to SVG

Aspose.PDF for Python via .NET supports the feature to convert SVG image to PDF format. To accomplish this requirement, the SvgSaveOptions class has been introduced into the Aspose.PDF namespace. Instantiate an object of SvgSaveOptions and pass it as a second argument to the Document.Save(..) method.

Below code snippet follows these steps:

  1. Create an object of the Document class.
  2. Create SvgSaveOptions object with needed settings.
  3. Call the Document.Save() method and pass it SvgSaveOptions object convert the PDF document to SVG.
import aspose.pdf as ap

# Open PDF document
document = ap.Document("input.pdf")

# Instantiate an object of SvgSaveOptions
saveOptions = ap.SvgSaveOptions()

# Do not compress SVG image to Zip archive
saveOptions.compress_output_to_zip_archive = False
saveOptions.treat_target_file_name_as_directory = True

# Save the output in SVG files
document.save("output.svg", saveOptions)

Merge PDF Files

Merge multiple PDF into single file in Python with Aspose.PDF programmatically. PDF files are merged such that the first one is joined at the end of the other document.

Below code snippet follows these steps:

  1. Open first document.
  2. Open second document.
  3. Add pages of second document to the first.
  4. Save concatenated output file.
import aspose.pdf as ap

# Open first document
document1 = ap.Document("input_1.pdf")
# Open second document
document2 = ap.Document("input_2.pdf")

# Add pages of second document to the first
document1.pages.add(document2.pages)

# Save concatenated output file
document1.save("output.pdf")

Print PDF to XPS printer

You can print a PDF file to an XPS printer, or some other soft printer for that matter, using the PdfViewer class.

Below code snippet follows these steps:

  1. Create an object of the PdfViewer class.
  2. Open the PDF file using the bind_pdf method.
  3. Set different print settings using the PrinterSettings and PageSettings classes.
  4. Set the printer_name property to the XPS or other printer.
  5. Print document using the print_document_with_settings method.
import aspose.pdf as ap
import aspose.pydrawing as drawing

# Create PdfViewer object
viewer = ap.facades.PdfViewer()

# Open input PDF file
viewer.bind_pdf("input.pdf")

# Set attributes for printing
# Print the file with adjusted size
viewer.auto_resize = True
# Print the file with adjusted rotation
viewer.auto_rotate = True
# Do not produce the page number dialog when printing
viewer.print_page_dialog = False

# Create objects for printer and page settings
ps = ap.printing.PrinterSettings()
pgs = ap.printing.PageSettings()

# Set XPS/PDF printer name
ps.printer_name = "Microsoft XPS Document Writer"
# Or set the PDF printer
# ps.printer_name = "Adobe PDF"

# Set PageSize(if required)
pgs.paper_size = ap.printing.PaperSize("A4", 827, 1169)

# Set PageMargins(if required)
pgs.margins = ap.devices.Margins(0, 0, 0, 0)

# Print document using printer and page settings
viewer.print_document_with_settings(pgs, ps)

# Close the PDF file after printing
viewer.close()

Product Page | Documentation | Examples | Demos | Blog | API Reference | Search | Free Support | Temporary License

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aspose_pdf-26.8.0-py3-none-win_amd64.whl (136.1 MB view details)

Uploaded Python 3Windows x86-64

aspose_pdf-26.8.0-py3-none-win32.whl (128.3 MB view details)

Uploaded Python 3Windows x86

aspose_pdf-26.8.0-py3-none-manylinux1_x86_64.whl (166.5 MB view details)

Uploaded Python 3

aspose_pdf-26.8.0-py3-none-macosx_11_0_arm64.whl (150.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

aspose_pdf-26.8.0-py3-none-macosx_10_14_x86_64.whl (156.3 MB view details)

Uploaded Python 3macOS 10.14+ x86-64

File details

Details for the file aspose_pdf-26.8.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: aspose_pdf-26.8.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 136.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for aspose_pdf-26.8.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 657564764a5e23dff95219a189de09f0f71c82478e53a8ca5ee5482830b47433
MD5 54614e9d44c793eaea744da01b7a79da
BLAKE2b-256 aff3eda8e4411035393f72480594b17700072e962deb44846a65957c7ea311cf

See more details on using hashes here.

File details

Details for the file aspose_pdf-26.8.0-py3-none-win32.whl.

File metadata

  • Download URL: aspose_pdf-26.8.0-py3-none-win32.whl
  • Upload date:
  • Size: 128.3 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for aspose_pdf-26.8.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 10af6c08d7459fa9ace8ef711ccfa293475c9e171f4ef3b03d4fae247b9c38ab
MD5 20965428a52149e66ce702c324b86775
BLAKE2b-256 bb91481e4f0df7a05c290cc7b78ca6a65c9d210546ec4e6c507c5a720862f737

See more details on using hashes here.

File details

Details for the file aspose_pdf-26.8.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for aspose_pdf-26.8.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c637a41f6399ea28e0a2b8e9a8bff464ed75537b5492042a74ba5c863e88a4bd
MD5 403aa6886b293c70e79686f80562ac68
BLAKE2b-256 3b96e2b715cc2ee72b4e8462b7ea953df7be3c858fc21af750df694c60f074f3

See more details on using hashes here.

File details

Details for the file aspose_pdf-26.8.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for aspose_pdf-26.8.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 619da3b8351757833f183fff30bbbbfe59052730ff447944e7d4228dc49e493e
MD5 70f75bb1c17aef5601fbd9d8e5f28cc9
BLAKE2b-256 249ff46a31ec030c1141137b62b0284123f9dc1d8bbed833e04a2d0bf13d33b4

See more details on using hashes here.

File details

Details for the file aspose_pdf-26.8.0-py3-none-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for aspose_pdf-26.8.0-py3-none-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8c1f0d25836205a2c1fa402170300dcf0b64f4d8af74a5dc485f90093a083344
MD5 b758deeaae51991a33d4af17e5cc0951
BLAKE2b-256 8bea023b142c837367f945891be1f9f75b690fa8dd3d021a1ca6d439bee2d196

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

26.8.0 This release

5 files

26.7.0

3 files

26.6.0

5 files

26.5.0

5 files

26.4.0

5 files

26.3.0

5 files

26.2.0

5 files

26.1.0

5 files

25.12.0

5 files

25.9.0

4 files

25.6.0

3 files

25.3.0

3 files

25.1.0

3 files

24.12.0

3 files

24.9.0

3 files

24.6.0

3 files

24.1.0

3 files

23.12.0

3 files

23.9.0

3 files

23.6.0

3 files

23.1.0

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page