Comprehensive PDF Manipulation Class Library for Python
Product Page | Documentation | Examples | Forum | Temporary License | Customized Demo
Spire.PDF for Python is a robust and versatile PDF manipulation library designed to simplify PDF reading, creation, editing, conversion, and management tasks within Python applications. Developed by E-iceblue, this reliable package offers a complete suite of tools enabling developers to effortlessly build solutions for working with PDF documents in Python programs.
This Python library empowers users to streamline document workflows by providing a rich set of APIs that facilitate seamless integration with enterprise-level PDF processing needs. It supports a wide array of advanced features without the need for any external dependencies, ensuring compatibility and performance consistency.
Core Features & Functionality
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
- Convert PDF to images (PNG, JPG, BMP, etc.) for wide distribution
- Convert PDF to Word documents for easy content editing
- Convert PDF to Excel workbooks for convenient data processing
- Convert PDF to SVG and many other formats effortlessly
Solid PDF Security Measures
- Protect PDF documents with passwords for secure sharing
- Set PDF security permissions to control access and usage
- Sign PDF documents with digital signature for certified trust
Efficient PDF Construction & Manipulation
- Create new PDF documents with customizable attributes and layouts
- Merge multiple PDFs into one PDF or split a PDF into separate PDFs
Effortless PDF Content Extraction
- Extract text from PDFs with simple Python code
- Extract images from PDFs for further editing and utilization
Code Examples
Create PDF Documents
from spire.pdf.common import *
from spire.pdf import *
outputFile = "HelloWorld.pdf"
# 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(outputFile)
doc.Close()
Convert PDFs to Word Documents
from spire.pdf.common import *
from spire.pdf import *
outputFile = "ToDocx.docx"
inputFile = "./Demos/Data/ToDocx.pdf"
# Load a pdf document
inputfile = inputFile
doc = PdfDocument()
doc.LoadFromFile(inputfile)
# Convert to doc file.
doc.SaveToFile(outputFile, 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()
inputFile = "./Demos/Data/PDFTemplate-Az.pdf"
outputFile = "ExtractTextFromParticularPage_out.txt"
doc = PdfDocument()
# Read a pdf file
doc.LoadFromFile(inputFile)
# 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(outputFile, text)
doc.Close()
Product Page | Documentation | Examples | Forum | Temporary License | Customized Demo
Metadata
Release files for spire-pdf 12.9.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| spire_pdf-12.9.4-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| spire_pdf-12.9.4-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details |
| spire_pdf-12.9.4-py3-none-manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| spire_pdf-12.9.4-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
| spire_pdf-12.9.4-py3-none-macosx_10_7_universal.whl | Python 3 | none | macOS 10.7+ universal (x86-64, i386, PPC64, PPC) | Details |
Total release size: 187.5 MB
Release files / spire_pdf-12.9.4-py3-none-win_amd64.whl
| Download URL | spire_pdf-12.9.4-py3-none-win_amd64.whl |
|---|---|
| Size | 29.6 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3e56729dc7e48ff75470fd6107023ebd147b0808f228aa77327d59238c080668
|
|
BLAKE2b-256 checksum How to use checksums |
35e4a4bdd08e019e1f885a4a211c408639803274f279df4950df370293f28e33
|
| 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-12.9.4-py3-none-manylinux_2_34_x86_64.whl
| Download URL | spire_pdf-12.9.4-py3-none-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 45.3 MB |
| Tags | Linux glibc 2.34+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
943362770d2d2211e66eb625c6a6e9224abce04436c40da56ae1b2eac9204dba
|
|
BLAKE2b-256 checksum How to use checksums |
21aa0b1afe4da7dfa450e458f1c4f58183db689708a7008f2c99282f246e925d
|
| 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-12.9.4-py3-none-manylinux2014_aarch64.whl
| Download URL | spire_pdf-12.9.4-py3-none-manylinux2014_aarch64.whl |
|---|---|
| Size | 26.8 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
7b71c7f5420163dddd475f1b7f62b66961dcd4f87df33085f742bfe6ae55f073
|
|
BLAKE2b-256 checksum How to use checksums |
241fcfdb894e52d05476d42bef0c9283832d64ee2a419f681c38e70ff6e0f296
|
| 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-12.9.4-py3-none-macosx_11_0_arm64.whl
| Download URL | spire_pdf-12.9.4-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 30.7 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a2fab1ce1bbc35d23746d1892060bf109eb3e2b7caeb31bf1735d71feadf7eef
|
|
BLAKE2b-256 checksum How to use checksums |
4e451021fc6b3fa3f7e2d8071e74850e597e0d064f1d55c739f32edd699a7a55
|
| 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-12.9.4-py3-none-macosx_10_7_universal.whl
| Download URL | spire_pdf-12.9.4-py3-none-macosx_10_7_universal.whl |
|---|---|
| Size | 55.1 MB |
| Tags | Python 3 macOS 10.7+ universal (x86-64, i386, PPC64, PPC) |
|
SHA-256 checksum How to use checksums |
77b576c0cd5a97976fd8158222c0b5d1cc06c98acfb8a0d44d791cd5c472d45d
|
|
BLAKE2b-256 checksum How to use checksums |
fd935c8ebcb1caff8fd9428cf85c94381f7f0bfa50973ea19a3c571f44ef5010
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|