Skip to main content

A utility library for pdf manupulation

Project description

PyPdfOps: Python PDF Operations Library

PyPdfOps is a Python library that simplifies the manipulation of PDF files. It provides a set of methods for common PDF operations, including compression, conversion to different formats (pptx, images, doc), splitting, and merging. With PyPdfOps, you can streamline your PDF-related tasks in your Python projects.

Check out the library on PYPI

PyPDFOps PYPI Repository

Installation

pip install pypdfops

Usage

1. PDF Compression

For compressing pdf, PDFNet sdk is used and a token is required to use the compressing feature. To obtain a demo token, head to 'https://dev.apryse.com/get-key', after signin, choose web and get the trial key.

from pypdfops import PDFOps 
input_pdf = "input.pdf"
output_pdf = "compressed_output.pdf"
pdf = PDFOps(token = "COMPRESSION_TOKEN") # Token for compression
pdf.compress_pdf(input_pdf, output_pdf)

2. PDF to PPTX Conversion

from pypdfops import PDFOps 
input_pdf = "input.pdf"
output_pptx = "converted_pdf.pptx"
pdf = PDFOps()
pdf.convert_to_pptx(input_pdf, output_pptx)

3. PDF to Images Conversion

from pypdfops import PDFOps 
input_pdf = "input.pdf"
output_folder = "Images"
pdf = PDFOps()
pdf.extract_pages_as_images(input_pdf, output_folder)

4. PDF to DOC Conversion

from pypdfops import PDFOps 
input_pdf = "input.pdf"
output_doc = "converted_pdf.doc"
pdf = PDFOps()
pdf.convert_to_doc(input_pdf, output_doc)

5. PDF Splitting

from pypdfops import PDFOps 
input_pdf = "input.pdf"
output_folder = "SplittedPdfs"
pages_to_split = [[1,2],[3,5]]
pdf = PDFOps()
pdf.split_pdf(input_pdf, output_folder,pages_to_split)

6. PDF Merging

from pypdfops import PDFOps 
input_pdfs = [
    "input1.pdf",
    "input2.pdf",
    "input3.pdf"
]
output_pdf = "Merged.pdf"
pdf = PDFOps()
pdf.merge_pdfs(input_pdfs, output_pdf)

7. PDF Encryption

from pypdfops import PDFOps 
input_pdf = "input.pdf
output_pdf = "encrypted.pdf"
password = "12345678"
pdf = PDFOps()
pdf.encrypt_pdf(input_pdf, output_pdf, password)

8. PDF Decryption

from pypdfops import PDFOps 
input_pdf = "input.pdf
output_pdf = "decrypted.pdf"
password = "12345678"
pdf = PDFOps()
pdf.decrypt_pdf(input_pdf, output_pdf, password)

Feel free to customize the examples and add more details to suit your specific use cases.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Project details


Download files

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

Source Distribution

pypdfops-0.0.3.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

pypdfops-0.0.3-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pypdfops-0.0.3.tar.gz.

File metadata

  • Download URL: pypdfops-0.0.3.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for pypdfops-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a6e84927c56424786ec2ffa0a36d645f731d5d849a6f1eb4bf30b014002716b7
MD5 cabe421bf23e549d87d5082b7145170e
BLAKE2b-256 3d1fe744d49d18d683c866a890ee930f6d2a73a0c06c580883e9a18379db81f7

See more details on using hashes here.

File details

Details for the file pypdfops-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pypdfops-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for pypdfops-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9768259de11eb4687a52f86d01a3d4579ce5b59255d1042975ff0b465ab6af20
MD5 b3908edc937eb8afc52c345a0602a25f
BLAKE2b-256 35696712a28d508a1a035d85d8077278fa2d3230fae554f02dce149bc06d6daa

See more details on using hashes here.

Supported by

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