AI Tool

GPT PDF Translator

A powerful application that translates PDF documents to various languages while preserving the original layout, formatting, and background colors using OpenAI API.

AIOpenAIPythonFastAPIOpen Source
GPT PDF Translator

Overview

GPT PDF Translator is a web application that translates PDF documents into any language while preserving the original layout, formatting, and background colors. It extracts text blocks with their positions, font styles, and sizes, detects background colors, translates using OpenAI's API, and recreates the PDF with translated text in matching styles — all with real-time WebSocket progress tracking.

The Challenge

Translating PDF documents typically destroys the original layout, formatting, and design elements. Existing tools produce messy outputs that lose the structure, background colors, and font styles of the source document, making translated PDFs look unprofessional and hard to read.

The Solution

Built a FastAPI application that intelligently extracts text blocks while preserving their positions, detects background colors by rendering and analyzing text block areas, translates via OpenAI's API, and recreates the PDF by overlaying translated text with matching font styles and intelligent text wrapping — all with real-time WebSocket progress updates.

Key Features

  • 01Exact layout preservation — maintains original PDF text positioning, images, and graphics
  • 02Background color detection — preserves the background color of each text block
  • 03Font style retention — maintains bold, italic, and other text formatting
  • 04Real-time WebSocket progress tracking during translation
  • 05Multiple language support via OpenAI models
  • 06Intelligent text wrapping for longer translated text
  • 07User-friendly web interface for uploading and translating PDFs

Technologies Used

PythonFastAPIOpenAI APIWebSocketPyMuPDF

Results

Open-source tool that enables seamless PDF translation while maintaining professional document quality.