Skip to content

This Django web application allows users to upload images and convert them into PDF files. It leverages the powerful Pillow library for image handling and ReportLab for generating PDF files. The application is designed for simplicity, allowing users to upload an image, convert it to PDF, and download the resulting file.

Notifications You must be signed in to change notification settings

mmhjmaili/image_to_pdf_with_Django

Repository files navigation

Image to PDF Converter

This Django web application allows users to upload images and convert them into PDF files. It leverages the powerful Pillow library for image handling and ReportLab for generating PDF files. The application is designed for simplicity, allowing users to upload an image, convert it to PDF, and download the resulting file.

Features

  • Image Upload: Supports uploading of images in formats such as PNG, JPEG, etc.
  • PDF Conversion: Converts uploaded images to PDF format with the same dimensions as the original image.
  • Downloadable PDF: Provides the user with a downloadable PDF file directly from the browser.

Requirements

  • Python 3.x
  • Django 4.x
  • Pillow
  • ReportLab

Installation

  1. Clone the repository:
    git clone https://github.com/mmhjmaili/image_to_pdf_with_Django.git
  2. Navigate to the project directory:
    cd image_to_pdf_with_Django
  3. Create the Django app:
    django-admin startapp imagetopdf
  4. Install the dependencies:
    pip install -r requirements.txt
  5. Apply migrations:
    python manage.py migrate
  6. Run the server:
    python manage.py runserver
  7. Visit http://127.0.0.1:8000/convert/ in your browser to upload an image and convert it to PDF.

Configuration

Before running the application, make sure to update the following files:

  1. Add the app to INSTALLED_APPS in project/settings.py:

    'imagetopdf',
  2. Add the app's URLs to project/urls.py:

    path('', include('imagetopdf.urls', namespace='imagetopdf'))

Usage

  1. Navigate to the image upload page.
  2. Select an image from your local machine.
  3. Click the "Convert to PDF" button.
  4. The generated PDF will be available for download immediately.

Project Structure

.
├── imagetopdf
│   ├── migrations
│   ├── forms.py                           # Django forms for image upload
│   ├── models.py                          # Image model definition
│   ├── views.py                           # Logic for converting images to PDF
│   ├── urls.py                            # URL routing for the app
├── templates
│   └── imagetopdf
│       └── convert_image_to_pdf.html      # HTML template for image upload
├── media                                  # Uploaded images and generated PDFs
├── requirements.txt                       # Project dependencies
├── manage.py
└── README.md

Contributing

Contributions are welcome! If you have any suggestions or improvements, feel free to open an issue or submit a pull request.

Need Help?

If you need assistance, you can reach out to the developer community on Telegram:

https://t.me/Web_Developer_DevOps

=======================================================================================================================================================================

محول الصور إلى PDF

يتيح لك هذا التطبيق المبني على Django رفع الصور وتحويلها إلى ملفات PDF. يعتمد على مكتبة Pillow للتعامل مع الصور وReportLab لتوليد ملفات PDF. تم تصميم التطبيق ليكون بسيطًا، مما يسمح للمستخدمين برفع صورة، تحويلها إلى PDF، وتنزيل الملف الناتج.

الميزات

  • رفع الصور: يدعم رفع الصور بصيغ مثل PNG وJPEG وغيرها.
  • تحويل إلى PDF: يحول الصور المرفوعة إلى صيغة PDF بنفس أبعاد الصورة الأصلية.
  • تنزيل ملف PDF: يوفر للمستخدم ملف PDF جاهزًا للتنزيل مباشرةً من المتصفح.

المتطلبات

  • Python 3.x
  • Django 4.x
  • Pillow
  • ReportLab

التثبيت

  1. استنساخ المستودع:
    git clone https://github.com/mmhjmaili/image_to_pdf_with_Django.git
  2. الانتقال إلى مجلد المشروع:
    cd image_to_pdf_with_Django
  3. إنشاء التطبيق:
    django-admin startapp imagetopdf
  4. تثبيت المتطلبات:
    pip install -r requirements.txt
  5. تطبيق الترقيات:
    python manage.py migrate
  6. تشغيل الخادم:
    python manage.py runserver
  7. زيارة الرابط التالي في المتصفح لتحويل الصور إلى PDF:
    http://127.0.0.1:8000/convert/

الإعدادات

قبل تشغيل التطبيق، تأكد من تحديث الملفات التالية:

  1. إضافة التطبيق إلى INSTALLED_APPS في project/settings.py:

    'imagetopdf',
  2. إضافة روابط التطبيق إلى project/urls.py:

    path('', include('imagetopdf.urls', namespace='imagetopdf'))

الاستخدام

  1. انتقل إلى صفحة رفع الصور.
  2. اختر صورة من جهازك.
  3. اضغط على زر "تحويل إلى PDF".
  4. سيكون ملف PDF الناتج جاهزًا للتنزيل فورًا.

هيكل المشروع

.
├── imagetopdf
│   ├── migrations
│   ├── forms.py                           # استمارات Django لرفع الصور
│   ├── models.py                          # تعريف نموذج الصور
│   ├── views.py                           # المنطق لتحويل الصور إلى PDF
│   ├── urls.py                            # توجيه روابط التطبيق
├── templates
│   └── imagetopdf
│       └── convert_image_to_pdf.html      # قالب HTML لرفع الصور
├── media                                  # الصور المرفوعة وملفات PDF الناتجة
├── requirements.txt                       # الاعتماديات الخاصة بالمشروع
├── manage.py
└── README.md

المساهمة

المساهمات مرحب بها! إذا كانت لديك اقتراحات أو تحسينات، لا تتردد في فتح قضية أو إرسال طلب سحب.

تحتاج إلى مساعدة؟

إذا كنت بحاجة إلى مساعدة، يمكنك التواصل مع مجتمع المطورين عبر تيليجرام:

https://t.me/Web_Developer_DevOps

About

This Django web application allows users to upload images and convert them into PDF files. It leverages the powerful Pillow library for image handling and ReportLab for generating PDF files. The application is designed for simplicity, allowing users to upload an image, convert it to PDF, and download the resulting file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published