Skip to content

mezentsevs/converter-pdf-to-jpeg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

247 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Converter pdf to jpeg

About 'Converter pdf to jpeg'

This is a converter pdf to jpeg, written in and for educational and demonstrational purposes.

A backend service for converting pdf documents into jpeg images. It handles file upload, validation, and processing. The results are instantly displayed in an in-browser slider for preview, and are also provided as a downloadable archive containing all images and a portable slider for offline use.

Based on tech stack:

Key Features

  • Secure Document Upload & Validation - Users can upload PDF documents with strict validation for file type, size, and maximum page count. Uploaded files are stored with a unique hashed filename to prevent conflicts and ensure secure storage.

  • High-Quality Conversion Engine - Uses the ImageMagick library to convert each PDF page into a high-resolution JPEG image with optimized compression and automatic portrait orientation correction.

  • Asynchronous Job Processing - Conversion tasks are handled in the background using Laravel Queues, ensuring a responsive user interface and reliable processing of documents.

  • Interactive In-Browser Preview - Converted images are instantly displayed in a built-in, interactive slider, allowing users to navigate between pages directly in their browser.

  • Portable Archive Download - Users can download a self-contained ZIP archive containing all generated JPEG images and a standalone HTML slider for offline viewing and easy sharing.

  • Full User Authentication & Management - Includes secure user registration, login, and profile management powered by Laravel Breeze and Sanctum.

  • Modern Responsive Interface - Features a clean, mobile-friendly UI built with Tailwind CSS with a fully responsive design for all screen sizes, including a light/dark theme toggle for user preference.

Getting Started

  • Clone the repository:
git clone [repository-url]
  • Change directory to project:
cd /path/to/converter-pdf-to-jpeg/
  • Install php dependencies (temporary ignore ext-imagick if not installed):
composer install --ignore-platform-req=ext-imagick
  • Create .env file:
cp .env.example .env
  • Generate application key:
php artisan key:generate
  • Run Docker Desktop (with wsl - for Windows only)

  • Run wsl (for Windows only):

wsl
  • Run Sail:
./vendor/bin/sail up
  • Add new tab in terminal and connect to container:
docker exec -it converter-pdf-to-jpeg-laravel.test-1 bash
  • Install php dependencies:
composer install
  • Run migrations:
php artisan migrate
  • Install node dependencies:
npm install
  • Build project:
npm run build
php artisan migrate:fresh --seed

That's it! Now you can upload pdf documents, convert to jpeg and download zip archives with sliders. For example, you can use pdf documents in tests/Dummies/Documents directory for testing. Thank you!

Scheduled Cleanup

The application uses Laravel's built-in model pruning to automatically clean up old conversion data and free up disk space.

Automated Cleanup

  • What it does: The system automatically removes documents, their generated images, sliders, archive files, and related database records that are older than 24 hours.
  • When it runs: Every Sunday at 00:00 (midnight, start of Monday).
  • How it works: The Document model uses the MassPrunable trait. The scheduled task model:prune finds and deletes old records. Before deletion, the model's pruning() method ensures all associated files are removed from storage. The process includes error handling to log any file system issues without interrupting the cleanup.

Manual Cleanup

You can trigger the cleanup process manually at any time by running the following command in your terminal:

php artisan model:prune --model=App\\Models\\Document

To customize the age threshold for manual cleanup (temporarily), you can:

  1. Temporarily modify the prunable() method in app/Models/Document.php to use a different time interval (e.g., now()->subHours(12) for 12 hours).
  2. Run the command above.

Configuration

The cleanup logic is defined within the Document model itself (app/Models/Document.php):

  • Age Threshold: Configured in the prunable() method (default: now()->subDay() for 24 hours). Modify this method to change how old records must be to be deleted.
  • File Deletion: Handled in the pruning() and deleteDocumentFiles() methods, which safely remove all related files from both public and private storage disks.

The scheduled task is configured in bootstrap/app.php using the withSchedule() method. You can adjust the schedule by modifying the weeklyOn(0, '0:00') call using Laravel's scheduler syntax.

Screenshots

2025-12-23_13-53-53 2025-12-23_13-56-09 2025-12-23_13-57-52 2025-12-23_13-59-34 2025-12-23_14-02-53 2025-12-23_14-03-46 2025-12-23_14-06-12 2025-12-23_14-07-34 2025-12-23_14-09-27 2025-12-23_14-10-13 2025-12-23_14-11-47 2025-12-23_14-12-32 2025-12-23_14-13-43 2025-12-23_14-16-27 2025-12-23_14-17-32 2025-12-23_14-18-23 2025-12-23_14-19-41 2025-12-23_14-20-28 2025-12-23_14-23-03 2025-12-23_14-24-22 2025-12-23_14-30-06 2025-12-23_14-31-48 2025-12-23_14-33-42 2025-12-23_14-34-29 2025-12-23_14-36-03 2025-12-23_14-36-57 2025-12-23_14-37-55 2025-12-23_14-38-32 2025-12-23_14-41-53 2025-12-23_14-42-39 2025-12-23_14-43-41 2025-12-23_14-44-22

Portable Slider

2025-12-29_16-33-56 2025-12-29_16-34-53 2025-12-29_16-37-26 2025-12-29_16-40-12

License

The 'Converter pdf to jpeg' is open-sourced software licensed under the MIT license.

Third-Party Licenses

This project uses third-party software components. Their respective licenses can be found in the LICENSE-3rd-party.md file.

About

πŸͺ„ A backend service for converting pdf documents into jpeg images. It handles file upload, validation, and processing. The results are instantly displayed in an in-browser slider for preview, and are also provided as a downloadable archive containing all images and a portable slider for offline use.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors