# PDF Image Extractor
PDF Image Extractor is a Python script designed to extract images from PDF files and convert them into SVG format. This tool is ideal for users who need to transform PDF content into image formats for further editing or other applications.
## Features
- Extracts images from each page of a PDF file.
- Converts extracted images into SVG format.
- Saves the converted images in a specified output directory.
## Requirements
To run this script, the following Python packages need to be installed:
- `pdf2image`: Converts PDF pages to images.
- `cairosvg`: Converts PNG images to SVG format.
- `Pillow`: Handles image files.
You can install these packages using pip:
```bash
pip install pdf2image cairosvg Pillow
Additionally, Poppler is required for the pdf2image
library to function correctly. Install it on Ubuntu with:
sudo apt-get install poppler-utils
-
Clone the repository (if applicable):
git clone <repository-url> cd <repository-directory>
-
Place your PDF file in the project directory or specify the path in the script.
-
Edit the script as necessary:
- Update the
pdf_file
variable with the path to your PDF file. - Update the
output_directory
variable with your desired output directory name.
- Update the
-
Run the script:
python your_script_name.py
Here’s an example of how to set up and run the script:
pdf_file = "QUIMICA-1.pdf" # Replace with your PDF file path
output_directory = "extracted_images"
extract_images_from_pdf(pdf_file, output_directory)
The extracted images will be saved in the specified output directory as SVG files named page_1.svg
, page_2.svg
, etc.
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a pull request or open an issue with any suggestions or improvements.
- This project uses pdf2image for converting PDFs to images.
- Thanks to CairoSVG for providing an easy way to convert images to SVG format.