Aspose.PDF FOSS for Python is an open-source library for creating, reading, editing,
rendering, and validating PDF documents. Built for Python 3.11 and later, it ships type
information and integrates into any Python project with a single
pip install aspose-pdf-foss-for-python command. The project is currently in alpha, so
APIs and feature coverage continue to evolve ahead of the first stable release.
The Document class is the central entry point, exposing pages, form, outlines,
and tagged_content for structural editing alongside encrypt, decrypt, merge,
optimize, and flatten operations. Text is added with Page.add_text() and extracted
or searched with PdfExtractor and TextFragmentAbsorber, including phrase- and
regex-based replacement and redaction. Pages render to PNG or TIFF raster images through
Page.render() and Page.save_as_image(). Interactive AcroForm fields are created and
filled through Form and Field, and documents can be checked or converted toward
PDF/A and PDF/UA compliance with Document.validate_pdfa(), Document.convert_to_pdfa(),
and Document.auto_tag().
Aspose.PDF FOSS for Python is released under the MIT license with no runtime fees or
usage restrictions. The core package depends only on cryptography and asn1crypto,
with optional extras for Pillow-based image support, Brotli-based WOFF2 decoding, and
HarfBuzz-based complex text layout. For enterprise features and support, see
Aspose.PDF for Python — Enterprise Product.
DocumentPageCollection exposed as document.pagesPage.add_text()Page.add_image()Page.draw_rectangle() and Page.draw_line()PdfExtractor and get_text()has_next_page_text() and get_next_page_text()TextFragmentAbsorberDocument.replace_text()Document.redact_text(), optionally drawing an overlay barPage.render()Page.save_as_image()Document.save_page_as_image()dpi parameter and edge quality with antialiasRasterizedPageDocument.formForm.add_text_field()Form.add_checkbox() and Form.add_radio_group()Form.add_list_box() and Form.add_combo_box()Field.value, then flatten with Document.flatten()Document.encrypt() using user and owner passwordsDocument.change_passwords() and Document.decrypt()PdfSignature.validate()PdfLoadLimitsValidationResultDocument.validate_pdfa()Document.convert_to_pdfa()Document.validate_pdfua()Document.auto_tag()Document.tagged_contentBuild a new PDF document and add positioned text to a page in a few lines.
from aspose_pdf import Document
with Document() as document:
page = document.pages.add()
page.add_text(
"Hello from Aspose.PDF FOSS!",
x=72,
y=720,
font_size=18,
)
document.save("hello.pdf")
Load an existing PDF and save its first page as a raster image at a configurable DPI.
from aspose_pdf import Document
with Document() as document:
document.load_from("input.pdf")
document.pages[0].save_as_image("page-1.png", dpi=144)
Bind a document and pull all of its page text out with the extractor facade.
from aspose_pdf import PdfExtractor
with PdfExtractor() as extractor:
extractor.bind_pdf("input.pdf")
extractor.extract_text()
print(extractor.get_text())
Concatenate several PDF files into a single output document.
from aspose_pdf import PdfFileEditor
with PdfFileEditor() as editor:
if not editor.concatenate(["part-1.pdf", "part-2.pdf"], "merged.pdf"):
raise RuntimeError(editor.last_exception)