Images To PDF
The ImageToPdfConverter class creates PDF documents from images.
Call the ImageToPdfConverter.ImageToPdf function using a valid file path to an image to produce a new PDF document from that image.
Calling ImageToPdfConverter.ImageToPdf using a list of image paths will produce a single PDF document containing each image on separate pages.
- Import necessary modules:
FPDFfor creating PDF files,Imagefrom PIL for processing images, andosfor file operations. - The method
image_to_pdftakes one or multiple image paths and converts them into a PDF file, saving it at the specified output path. - Images are converted to RGB to ensure compatibility.
- Temporary files are used to maintain the consistency of image formats.
- The method handles single image paths and lists of image paths seamlessly.




