Skip to main content

Convert from different file formats to PDF format.

Project description

License: GNU GPLv3

How to install

pip install Convert2PDF

How to import

from Convert2PDF.ConvertToPDF import docx2pdfConvert, pptx2pdfConvert, img2pdfConvert, bmp2pdfConvert, txt2pdfConvert, mergePdfs

Dependencies needs to be installed, if using docx2pdfConvert() & pptx2pdfConvert()

libreoffice
build-essential
libssl-dev
libffi-dev
python-dev
default-jre

Documentation

Convert from doc or docx to pdf format.

docx = docx2pdfConvert(f'{os.getcwd()}/file name.docx', f'{os.getcwd()}/output_dir/')
doc = docx2pdfConvert(f'{os.getcwd()}/file name.doc', f'{os.getcwd()}/output_dir/')

Convert from ppt or pptx to pdf format

pptx = pptx2pdfConvert(f'{os.getcwd()}/file name.pptx', f'{os.getcwd()}/output/')
ppt = pptx2pdfConvert(f'{os.getcwd()}/file name.ppt', f'{os.getcwd()}/output/')

Convert from jpeg, jpg or png ot pdf format.

jpeg = img2pdfConvert(f'{os.getcwd()}/file name.jpeg', f'{os.getcwd()}/output/file name.pdf')
jpg = img2pdfConvert(f'{os.getcwd()}/file name.jpg', f'{os.getcwd()}/output/file name.pdf')
png = img2pdfConvert(f'{os.getcwd()}/file name.png', f'{os.getcwd()}/output/file name.pdf')

Convert from bmp to pdf format.

bmp = bmp2pdfConvert(f'{os.getcwd()}/file name.bmp', f'{os.getcwd()}/output/file name.pdf')

Convert from txt to pdf format.

txt = txt2pdfConvert(f'{os.getcwd()}/file name.txt', f'{os.getcwd()}/output/file name.pdf')

Merge all pdf files to one pdf file.

all_pdfs_path_tuple = (
                    f'{os.getcwd()}/file 1.pdf'
                    , f'{os.getcwd()}/file 2.pdf'
                    , f'{os.getcwd()}/file 2.pdf'
                    , f'{os.getcwd()}/file 3.pdf'
                    , f'{os.getcwd()}/file 4.pdf'
                    , f'{os.getcwd()}/file 5.pdf'
                )
merged = mergePdfs(*all_pdfs_path_tuple, output_pdf_file_path=f'{os.getcwd()}/output_merged_file.pdf')

License

GNU GPLv3

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

Convert2PDF-0.3.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file Convert2PDF-0.3.tar.gz.

File metadata

  • Download URL: Convert2PDF-0.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for Convert2PDF-0.3.tar.gz
Algorithm Hash digest
SHA256 beaa76b7222853ff132b2c31cfea9be48eb38cfca9b72a16632e9214d5e4ac9e
MD5 262fcc5c618ed75000341b4f29eba317
BLAKE2b-256 05a6af128a0b89838e065fc16816c2b6941e56137ecafc4f15ca20e51e5ca940

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