Skip to main content

A 100% standalone Pdf Python API for Processing Pdf Files

Project description

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

Project details


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.

Spire.Pdf.Free-10.12.0-py3-none-win_amd64.whl (27.0 MB view details)

Uploaded Python 3Windows x86-64

Spire.Pdf.Free-10.12.0-py3-none-manylinux1_x86_64.whl (42.0 MB view details)

Uploaded Python 3

Spire.Pdf.Free-10.12.0-py3-none-macosx_10_7_universal.whl (52.6 MB view details)

Uploaded Python 3macOS 10.7+ universal (x86-64, i386, PPC64, PPC)

File details

Details for the file Spire.Pdf.Free-10.12.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for Spire.Pdf.Free-10.12.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 52df74b4bab8c00d8fec68a64b9d4cfada93ec0d0d7f76f1d24be6cf848d0b4b
MD5 cb4fd33d2ab74070be9c3471ca04e435
BLAKE2b-256 33eb409469571191669fb8ab323ece4cac0c4f8fa3c009520e219c96f9fc3064

See more details on using hashes here.

File details

Details for the file Spire.Pdf.Free-10.12.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for Spire.Pdf.Free-10.12.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5be51a35c812eb17c39b7f361296e6bc7e45d0efbcb9f8ee9be3724b9e34c0c6
MD5 833be995a0a96bf021a978fb5ec71c71
BLAKE2b-256 610d404f5ee670c08fab308898c298fa29fcd7dbd6ee13c0f1ea3c18169e6c6b

See more details on using hashes here.

File details

Details for the file Spire.Pdf.Free-10.12.0-py3-none-macosx_10_7_universal.whl.

File metadata

File hashes

Hashes for Spire.Pdf.Free-10.12.0-py3-none-macosx_10_7_universal.whl
Algorithm Hash digest
SHA256 64824c86895fccf65777966dad4a74475566fda5cc913a1c4d63223153e33f43
MD5 adeb0563809375f8fc8fcb431e41ae76
BLAKE2b-256 2b0ab372408f51c44b2f98c7304d1231d47ca7d2bd0467adac826e016a1d7212

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page