Skip to content

DerilKrisyanto/file-converter-django

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Django Python LibreOffice Poppler PDF Support License

πŸš€ File Converter Django

A powerful web-based file converter built with Django that supports multiple document and image conversions using LibreOffice, Poppler, and Python-based processing libraries.

πŸ“Œ Overview

File Converter Django adalah aplikasi berbasis web yang memungkinkan pengguna melakukan konversi file langsung melalui browser. Project ini dirancang untuk: βœ”οΈ Cepat βœ”οΈ Stabil βœ”οΈ 100% Self-hosted βœ”οΈ Tidak menggunakan API berbayar βœ”οΈ Cocok untuk production & shared hosting (dengan penyesuaian)

🎯 Supported Conversions

βœ… Image & Office β†’ PDF

JPG β†’ PDF Word β†’ PDF Excel β†’ PDF PowerPoint β†’ PDF

βœ… PDF β†’ Format Lain

PDF β†’ JPG PDF β†’ Word PDF β†’ Excel PDF β†’ PowerPoint

πŸ›  Technology Stack

Python 3 Django LibreOffice (Headless mode) Poppler Pillow pdf2image pdf2docx pdfplumber openpyxl python-pptx OpenCV NumPy

🧰 REQUIREMENTS

Pastikan sistem Anda memiliki: Software Required Python 3.9+ βœ… pip βœ… LibreOffice βœ… Poppler βœ… Git βœ…

βš™οΈ FULL INSTALLATION GUIDE

1️⃣ Clone Repository

Buka CMD / Terminal:

git clone https://github.com/derilkrisyanto/file-converter-django.git cd file-converter-django

2️⃣ Check Python Installation

Pastikan Python terinstall: python --version pip --version

Jika belum ada, download dari: πŸ‘‰ https://www.python.org/downloads/

Saat install Python: βœ”οΈ Centang Add Python to PATH

3️⃣ Create Virtual Environment

Di dalam folder project: python -m venv venv

Aktifkan

  • Windows: venv\Scripts\activate
  • Mac/Linux: source venv/bin/activate

Jika berhasil, akan muncul: (venv)

4️⃣ Install Required Python Libraries

Jalankan: pip install django pip install rembg pip install opencv-python pip install numpy pip install pillow pip install pdf2image pdf2docx pdfplumber openpyxl python-pptx

Atau jika tersedia requirements.txt:

pip install -r requirements.txt

5️⃣ Install LibreOffice (WAJIB)

Download: πŸ‘‰ https://www.libreoffice.org/download/download/

Install seperti biasa.

Setelah install, pastikan lokasi: C:\Program Files\LibreOffice\program\soffice.exe

Jika berbeda, ubah di file: myapp/services/file_converter.py

Bagian: SOFFICE_PATH = r"C:\Program Files\LibreOffice\program\soffice.exe"

6️⃣ Install Poppler (WAJIB untuk PDF β†’ JPG & PPT)

Download Poppler Windows binary: πŸ‘‰ https://github.com/oschwartz10612/poppler-windows/releases

Ekstrak ke: C:\poppler-xx\

Contoh: C:\poppler-25.12.0\

Lalu pastikan path berikut benar di: POPPLER_PATH = r"C:\poppler-25.12.0\Library\bin"

Jika berbeda, sesuaikan.

7️⃣ Setup Django Project Structure

Jika Anda clone project lengkap, lewati langkah ini.

Jika setup manual: django-admin startproject core . python manage.py startapp myapp

Tambahkan di: core/settings.py INSTALLED_APPS = [ ... 'myapp', ]

8️⃣ Configure Static & Media

Tambahkan di core/settings.py: import os

STATIC_URL = 'static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATICFILES_DIRS = [ BASE_DIR / 'myapp' / 'static', ]

9️⃣ Setup URL Routing

core/urls.py from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static

urlpatterns = [ path('admin/', admin.site.urls), path('', include('myapp.urls')), ]

if settings.DEBUG: urlpatterns += static('media/file_converter/', document_root='media/file_converter') myapp/urls.py from django.urls import path from . import views

urlpatterns = [ path("", views.file_converter, name="file_converter"), path("cv/process/", views.converter_process), path("cv/file/str:filename/", views.converter_download), path("cv/cleanup/", views.converter_cleanup), ]

πŸ”Ÿ Run Database Migration

python manage.py migrate

1️⃣1️⃣ Create Admin User

python manage.py createsuperuser

1️⃣2️⃣ Collect Static Files

python manage.py collectstatic

1️⃣3️⃣ Run Development Server

python manage.py runserver

Buka browser: http://127.0.0.1:8000/

Admin panel: http://127.0.0.1:8000/admin/

🧠 How Conversion Works Internally

Office β†’ PDF Menggunakan LibreOffice headless mode.

PDF β†’ JPG Menggunakan Poppler + pdf2image.

PDF β†’ Word Menggunakan pdf2docx.

PDF β†’ Excel Menggunakan pdfplumber + openpyxl.

PDF β†’ PowerPoint Menggunakan Poppler convert page β†’ image β†’ slide.

πŸ” Security Notes

File disimpan sementara di media/file_converter/ File otomatis dihapus setelah download Tidak ada penyimpanan permanen

πŸ’Ž Advantages

βœ”οΈ 100% self-hosted βœ”οΈ Tidak perlu API eksternal βœ”οΈ Mendukung banyak format βœ”οΈ UI modern βœ”οΈ Mudah dikembangkan βœ”οΈ Cocok untuk server lokal maupun VPS

⚠️ Troubleshooting

Error: LibreOffice failed Pastikan path SOFFICE_PATH benar

Coba test manual di CMD: "C:\Program Files\LibreOffice\program\soffice.exe" --version Error: Poppler not found

Pastikan POPPLER_PATH benar Pastikan folder Library/bin ada file .dll

πŸ“‚ Project Structure

file-converter-django/ β”‚ β”œβ”€β”€ core/ β”œβ”€β”€ myapp/ β”‚ β”œβ”€β”€ services/ β”‚ β”œβ”€β”€ static/ β”‚ β”œβ”€β”€ templates/ β”‚ β”œβ”€β”€ views.py β”‚ └── urls.py β”‚ β”œβ”€β”€ media/ β”œβ”€β”€ manage.py └── README.md

πŸ“œ License

Open-source project for educational and production use.

πŸ‘¨β€πŸ’» Author

Developed with Django & Python.

About

A powerful web-based file converter built with Django that supports multiple document and image conversions using LibreOffice, Poppler, and Python-based processing libraries.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors