Skip to main content

100% Free Python Library for PDF Processing and Generation - Versitle & Powerful

Foo

Product Page | Documentation | Examples | Forum | Temporary License | Customized Demo

Free Spire.PDF for Python is a powerful PDF API designed for creating, reading, editing, converting, and saving PDF files in Python applications, all without requiring any external dependencies. With this Python library, developers can leverage a wide range of features to generate PDF files from scratch or fully process existing ones through Python code.

Free Spire.PDF for Python supports numerous advanced features, including security settings, text and image extraction, PDF merging and splitting, drawing text, images, shapes, and barcodes, as well as creating and filling form fields. Additionally, it allows for adding or removing PDF layers, overlaying PDFs, inserting watermarks, managing bookmarks, adding tables, and compressing PDF files. The library also facilitates seamless conversions between PDF and various other formats, including XPS, SVG, Excel, Word, HTML, and PDF/A, ensuring high-quality results.

Friendly Reminder: Free version is limited to 10 pages of PDF. This limitation is enforced during writing PDF. When converting PDF to Image, XPS, Word, HTML, you can only get the first 3 pages of file. Upgrade to Commercial Edition of Spire.PDF for Python. We don't provide technical or any other support to the users of the free versions.

Core Features & Functionality

Installation

pip install Spire.Pdf

Extensive PDF Version Support

  • PDF 1.2 to PDF 1.7
  • PDF/A - 1b
  • PDF/x1a
  • PDF/A1
  • PDF/A2
  • PDF/A3
  • PDF/UA

Flexible PDF Document Conversions

Main Tutorials

Robust PDF Security Features

Efficient PDF Creation and Manipulation

Seamless PDF Content Extraction

Code Examples

Create PDF Documents

from spire.pdf.common import *
from spire.pdf import *

# Create a pdf document
doc= PdfDocument()
# Create one page
page = doc.Pages.Add()
s = "Hello, World"
x = 10.0
y = 10.0
font = PdfFont(PdfFontFamily.Helvetica ,30.0)
color = PdfRGBColor(Color.get_Black())
textBrush = PdfSolidBrush(color)
# Draw the text
page.Canvas.DrawString(s, font, textBrush, x, y)
# Save the document
doc.SaveToFile("HelloWorld.pdf")
doc.Close()

Convert PDFs to Word Documents

from spire.pdf.common import *
from spire.pdf import *

# Load a pdf document
inputfile = inputFile
doc = PdfDocument()
doc.LoadFromFile("ToDocx.docx")
# Convert to doc file.
doc.SaveToFile("./Demos/Data/ToDocx.pdf", FileFormat.DOCX)
doc.Close()

Encrypt PDF Documents

from spire.pdf.common import *
from spire.pdf import *

# Create a PdfDocument object
doc = PdfDocument()

# Load a sample PDF file
doc.LoadFromFile("input.pdf")

# Encrypt the PDF file with an open password and a permission password
doc.Security.Encrypt("openPsd", "permissionPsd", PdfPermissionsFlags.FillFields, PdfEncryptionKeySize.Key128Bit)

# Save the result file
doc.SaveToFile("output/Encrypted.pdf", FileFormat.PDF)

Extract Text from PDF Documents

from spire.pdf.common import *
from spire.pdf import *

def WriteAllText(fname:str,text:List[str]):
        fp = open(fname,"w")
        for s in text:
            fp.write(s)
        fp.close()

doc = PdfDocument()
# Read a pdf file
doc.LoadFromFile("./Demos/Data/PDFTemplate-Az.pdf")
# Get the first page
page = doc.Pages[0]
# Extract text from page keeping white space
text = page.ExtractText(True)
# Write a line of text to the file
WriteAllText("ExtractTextFromParticularPage_out.txt", text)
doc.Close()

Product Page | Documentation | Examples | Forum | Temporary License | Customized Demo

Metadata

Release files for Spire.Pdf.Free 10.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for Spire.Pdf.Free 10.12.0
File Interpreter ABI Platform
Spire.Pdf.Free-10.12.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
Spire.Pdf.Free-10.12.0-py3-none-manylinux1_x86_64.whl Python 3 none Linux glibc 2.5+ x86-64 Details
Spire.Pdf.Free-10.12.0-py3-none-macosx_10_7_universal.whl Python 3 none macOS 10.7+ universal (x86-64, i386, PPC64, PPC) Details

Total release size: 121.6 MB

Release files / Spire.Pdf.Free-10.12.0-py3-none-win_amd64.whl

Download URL Spire.Pdf.Free-10.12.0-py3-none-win_amd64.whl
Size 27.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
52df74b4bab8c00d8fec68a64b9d4cfada93ec0d0d7f76f1d24be6cf848d0b4b
BLAKE2b-256 checksum
How to use checksums
33eb409469571191669fb8ab323ece4cac0c4f8fa3c009520e219c96f9fc3064
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release files / Spire.Pdf.Free-10.12.0-py3-none-manylinux1_x86_64.whl

Download URL Spire.Pdf.Free-10.12.0-py3-none-manylinux1_x86_64.whl
Size 42.0 MB
Tags Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
5be51a35c812eb17c39b7f361296e6bc7e45d0efbcb9f8ee9be3724b9e34c0c6
BLAKE2b-256 checksum
How to use checksums
610d404f5ee670c08fab308898c298fa29fcd7dbd6ee13c0f1ea3c18169e6c6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release files / Spire.Pdf.Free-10.12.0-py3-none-macosx_10_7_universal.whl

Download URL Spire.Pdf.Free-10.12.0-py3-none-macosx_10_7_universal.whl
Size 52.6 MB
Tags Python 3 macOS 10.7+ universal (x86-64, i386, PPC64, PPC)
SHA-256 checksum
How to use checksums
64824c86895fccf65777966dad4a74475566fda5cc913a1c4d63223153e33f43
BLAKE2b-256 checksum
How to use checksums
2b0ab372408f51c44b2f98c7304d1231d47ca7d2bd0467adac826e016a1d7212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release history Release notifications | RSS feed

This release

10.12.0 This release

3 release 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