ingindIsrael/Free_PDF_Editor

Web app

โ˜… 0Forks 0TypeScriptGitHub โ†—Compare

README

Free PDF Editor

A completely free, browser-based PDF editor that allows users to upload, edit, and download PDFs without any registration or authentication required.

๐Ÿ”’ Privacy First

This application does NOT save any customer data:

  • โœ… Zero disk storage - All PDFs processed entirely in memory
  • โœ… No database - No persistent data storage
  • โœ… No file logging - No customer data in logs
  • โœ… Memory-only processing - Files discarded immediately after response
  • โœ… 100% stateless - No data retention whatsoever

See PRIVACY_STATUS.md for detailed privacy compliance information.

Overview

This project provides a modern, ad-supported PDF editing service that:

  • Requires no user authentication or registration
  • Shows a brief 5-second ad modal before editing begins
  • Offers full PDF editing capabilities (text, drawings, highlights, signatures, text selection)
  • Processes all files in memory - never saves to disk
  • Is completely free to use
  • 100% privacy compliant - no data storage or retention

Features

โœจ PDF Editing Capabilities

  • Text Annotations - Add custom text anywhere on the PDF
  • Drawing Tool - Freehand drawing with customizable colors
  • Highlights - Highlight important sections with color overlays
  • Signatures - Add text-based signatures to documents
  • Text Selection - Select and copy text directly from PDFs
  • Annotation Selection - Click to select, move, resize annotations
  • Multi-select - Select multiple annotations with Shift/Cmd+Click
  • Undo/Redo - Full history support for all operations
  • Zoom Controls - Zoom from 0.5x to 3x with accurate annotation positioning

๐ŸŽจ Frontend Stack

  • React + TypeScript - Modern, type-safe React application
  • Tailwind CSS - Utility-first CSS framework for styling
  • Material UI Icons - Professional icon set
  • Framer Motion - Smooth animations and transitions
  • Zustand - Lightweight state management
  • i18next - Internationalization (English, Spanish, French)
  • PDF.js - PDF rendering with text layer extraction for selection
  • Vite - Fast build tool and dev server

๐Ÿ”ง Backend Stack

  • Node.js + Express - RESTful API server
  • TypeScript - Type-safe backend code
  • Multer (Memory Storage) - File upload handling (memory-only)
  • pdf-lib - PDF manipulation and annotation rendering
  • Helmet - Security middleware
  • Rate Limiting - Prevent API abuse
  • Winston - Console-only logging (no file logs)

๐Ÿ“ฆ Key Components

  1. Ad Modal - 5-second countdown with non-intrusive ad display
  2. PDF Viewer - Interactive PDF rendering with page navigation and zoom controls
  3. Text Layer - Invisible text layer for native browser text selection
  4. Toolbar - Tools for text, drawing, highlighting, signatures, and selection
  5. Annotation Overlay - Renders annotations on top of PDF canvas
  6. Selection Overlay - Visual selection indicators with resize handles
  7. Download - Export edited PDFs instantly with annotations burned in

๐ŸŽฏ Technical Features

  • PDF Coordinate System - Accurate coordinate conversion between CSS pixels and PDF points using PDF.js transform matrices
  • Zoom-Independent Annotations - Annotations remain accurate across all zoom levels (0.5x - 3x)
  • Text Selection - Native browser text selection with proper text layer alignment
  • Non-destructive Editing - Annotations stored in PDF coordinate space, properly converted during export
  • Memory-Only Processing - All file operations happen in RAM, zero disk writes
  • Coordinate Transformation - Handles PDF.js (top-left origin) to pdf-lib (bottom-left origin) conversion

Getting Started

Prerequisites

  • Node.js 20+
  • npm or yarn
  • Docker (optional, for containerized deployment)

Installation

  1. Clone the repository:
git clone <repository-url>
cd Free_PDF_Editor
  1. Install root dependencies:
npm install
  1. Install frontend dependencies:
cd frontend
npm install
cd ..
  1. Install backend dependencies:
cd backend
npm install
cd ..

Running Locally

Development Mode

  1. Start the backend server:
npm run dev:backend

Server will run at http://localhost:3000

  1. In a new terminal, start the frontend:
npm run dev:frontend

Frontend will run at http://localhost:5173

Production Mode

  1. Build the application:
npm run build:frontend
npm run build:backend  # Or just use tsx watch in dev mode
  1. Start the server:
npm run start:backend

Docker Deployment

  1. Build and run with Docker Compose:
docker-compose up --build
  1. Access the application at http://localhost:3000

Project Structure

Free_PDF_Editor/
โ”œโ”€โ”€ frontend/                 # React frontend application
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # React components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ PDFViewer.tsx      # Main PDF viewer with annotation overlay
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ TextLayer.tsx      # Text selection layer
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SelectionOverlay.tsx # Selection indicators
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Toolbar.tsx        # Tool selection toolbar
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AdModal.tsx        # Ad display modal
โ”‚   โ”‚   โ”œโ”€โ”€ pages/           # Page components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ HomePage.tsx       # Landing page
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ EditorPage.tsx     # Main editor interface
โ”‚   โ”‚   โ”œโ”€โ”€ store/           # Zustand state management
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ pdfStore.ts        # PDF state and annotations
โ”‚   โ”‚   โ”œโ”€โ”€ utils/           # Utility functions
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ coordinateUtils.ts # PDF coordinate conversion
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ annotationUtils.ts # Annotation hit testing
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ api.ts             # API client
โ”‚   โ”‚   โ”œโ”€โ”€ i18n/            # Internationalization (EN, ES, FR)
โ”‚   โ”‚   โ””โ”€โ”€ types/           # TypeScript type definitions
โ”‚   โ”œโ”€โ”€ public/              # Static assets
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ backend/                 # Node.js backend server
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ controllers/     # Route controllers
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ pdf.controller.ts  # PDF processing endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ services/        # Business logic
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ pdf.service.ts     # PDF manipulation with pdf-lib
โ”‚   โ”‚   โ”œโ”€โ”€ routes/          # API routes
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ pdf.routes.ts      # PDF API routes
โ”‚   โ”‚   โ””โ”€โ”€ utils/           # Helper functions
โ”‚   โ”‚       โ”œโ”€โ”€ logger.ts          # Console-only logging
โ”‚   โ”‚       โ””โ”€โ”€ fileUtils.ts       # File validation utilities
โ”‚   โ”œโ”€โ”€ dist/                # Compiled TypeScript
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ Dockerfile               # Docker container config
โ”œโ”€โ”€ docker-compose.yml      # Docker Compose configuration
โ”œโ”€โ”€ setup.sh                # Setup script for dependencies
โ”œโ”€โ”€ QUICKSTART.md           # Quick start guide
โ”œโ”€โ”€ PRIVACY_STATUS.md       # Privacy compliance documentation
โ”œโ”€โ”€ DELETE_TEXT_PLAN.md     # Plan for text deletion feature
โ””โ”€โ”€ package.json            # Root package.json

API Endpoints

POST /api/pdf/process

Process a PDF with annotations and return the edited version.

Request:

  • file: PDF file (multipart/form-data)
  • annotations: JSON array of annotations (with PDF coordinate points)

Response: Edited PDF file with annotations burned in

Annotation Format:

{
  id: string;
  type: 'text' | 'drawing' | 'highlight' | 'signature';
  x: number;              // PDF points (not pixels)
  y: number;              // PDF points (not pixels)
  width?: number;        // PDF points
  height?: number;        // PDF points
  content?: string;       // For text annotations
  data?: string;          // For drawing paths or signature images
  color?: string;         // Hex color string
  pageNumber: number;     // 1-indexed page number
}

POST /api/pdf/compress

Compress a PDF to reduce file size.

Request:

  • file: PDF file (multipart/form-data)

Response: Compressed PDF file

POST /api/pdf/merge

Merge multiple PDFs into a single file.

Request:

  • files: Array of PDF files (multipart/form-data)

Response: Merged PDF file

GET /health

Health check endpoint.

Response: { status: 'ok', timestamp: ... }

Configuration

Backend Environment Variables

Create a .env file in the backend directory:

PORT=3000
NODE_ENV=development
FRONTEND_URL=http://localhost:5173
LOG_LEVEL=info

Frontend Environment Variables

Create a .env file in the frontend directory:

VITE_API_URL=http://localhost:3000/api

๐Ÿ”’ Security & Privacy Features

Security

  • Helmet.js - Sets various HTTP headers for security
  • Rate Limiting - Prevents API abuse (100 requests per 15 minutes per IP)
  • File Type Validation - Only accepts PDF files
  • File Size Limits - 50MB maximum file size
  • HTTPS Ready - Configured for secure connections
  • CORS Protection - Controlled cross-origin requests

Privacy

  • Memory-Only Storage - All files processed in RAM, never written to disk
  • No Database - Zero persistent data storage
  • No File Logging - Console logging only, no customer data logged
  • No Temp Files - Temporary file operations disabled
  • Stateless Architecture - No data retention between requests
  • Immediate Cleanup - Files discarded from memory after processing

See PRIVACY_STATUS.md for complete privacy compliance details.

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Roadmap

โœ… Completed Features

  • Basic PDF annotation tools (text, drawing, highlight, signature)
  • Proper PDF coordinate system with zoom support
  • Undo/redo history
  • Text selection and copying from PDFs
  • Annotation selection and visual feedback
  • Multi-select annotations (Shift/Cmd+Click)
  • Privacy-compliant architecture (memory-only processing)
  • Text layer rendering for native text selection

๐Ÿšง Planned Features

  • Delete existing PDF text (white-out overlay)
  • Advanced PDF annotation tools (sticky notes, arrows)
  • Drag-and-drop page reordering
  • OCR text extraction
  • PDF encryption/decryption
  • Batch processing
  • Mobile responsive optimization
  • Font embedding for custom text fonts
  • Collaborative editing features

๐Ÿ“‹ In Progress

Support

For issues, questions, or suggestions, please open an issue on the GitHub repository.

๐Ÿ“š Documentation

Acknowledgments

  • PDF.js team - Browser-based PDF rendering and text extraction
  • pdf-lib - PDF manipulation and annotation rendering
  • React team - Amazing framework for building UIs
  • All contributors and users - Thank you for using and improving this project

License

MIT License - feel free to use this project for personal or commercial purposes.

Contributors

ingindIsrael

Issues