Python script that will extract all images within an existing PDF file, to do this we will be using the PyPDF2 library. The PyPDF2 is a Python library that enables users to perform various operations on PDF documents.

This example will extract all images found within a PDF file, checking all pages. If you would like to support us please be sure to subscribe to our YouTube channel for daily coding content.

https://scriptopia.co.uk/2023/01/24/python-pypdf2-extract-images-from-pdf-file/

--

--

Python script that will write metadata to a PDF file, to do this we will be using the PDF reader from the PyPDF2 library. The PyPDF2 is a Python library that enables users to perform various operations on PDF documents.

In this example we are adding an ‘Author’ and ‘Title’ to the metadata of our PDF file. Be sure to subscribe to our YouTube channel for daily coding content.

--

--

Python script that will encrypt a PDF file. To do this we use PyPDF2 which is a Python library that enables users to perform various operations on PDF documents.

In this example the password for the encrypted file will be set to ‘iamlegend’, if you do use this code as part of your own project be sure to change this something appropriate.

Also be sure to subscribe to our YouTube channel for daily coding content.

https://scriptopia.co.uk/2023/01/20/python-pypdf2-encrypt-a-pdf-file/

--

--

Python script that will merge the contents of two PDF files and save it as a new file. To do this we use PyPDF2 which is a Python library that enables users to perform various operations on PDF documents.

In this example the contents of ‘file1.pdf’ will come first within our merged file. Also be sure to subscribe to our YouTube channel for daily coding content.

--

--

Python script that will merge multiple images into a single image, to do this we make use of the Python PIL library which enables us to image processing capabilities.

See below our first image for this example which we are wanting to merge.

scriptopia.co.uk

See below our second image for this example which we are wanting to merge.

--

--