HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/web-custom-tools/index.php
<?php include 'header.php'; ?>
<div class="container" style="margin: 40px auto; padding: 20px">
    <h1>📄 Text PDF Optimizer</h1>
    <p class="subtitle">Optimized for text-heavy PDFs with realistic expectations</p>

    <!-- <div class="reality-box">
        <h3>⚠️ Reality Check for Text PDFs</h3>
        <p><strong>Browser JavaScript CANNOT effectively compress text-heavy PDFs because:</strong></p>
        <ul>
            <li>Text PDFs are already highly efficient (vector text, embedded fonts)</li>
            <li>Real compression requires font subsetting, stream optimization, duplicate removal</li>
            <li>Converting text to images makes files 5-10x LARGER</li>
            <li>Your 10MB, 3075-page PDF is already well-optimized at ~3.3KB/page</li>
        </ul>
        <p><strong>This tool will:</strong> Remove metadata, optimize structure, compress any embedded images.
            <strong>Expected savings: 5-15%</strong></p>
    </div> -->

    <div class="upload-zone" id="uploadZone">
        <div class="upload-icon">📄</div>
        <div><strong>Click to select PDFs</strong> or drag and drop here</div>
        <div style="font-size: 13px; color: #718096; margin-top: 8px;">Works best with PDFs under 500 pages</div>
        <input type="file" id="fileInput" accept=".pdf,application/pdf" multiple />
    </div>

    <div class="settings">
        <h3>⚙️ Optimization Settings</h3>

        <div class="setting-row">
            <div class="setting-group">
                <label>Max Pages to Process</label>
                <select id="maxPages">
                    <option value="50">50 pages (Fast)</option>
                    <option value="100">100 pages (Balanced)</option>
                    <option value="500" selected>500 pages (Slow)</option>
                    <option value="9999">All pages (May crash)</option>
                </select>
            </div>

            <div class="setting-group">
                <label>Page Processing DPI</label>
                <input type="number" id="dpi" value="96" min="72" max="150" step="12" />
            </div>
        </div>

        <div class="setting-row">
            <div class="setting-group">
                <label>JPEG Quality (for images)</label>
                <input type="number" id="quality" value="0.4" min="0.1" max="1.0" step="0.1" />
            </div>

            <div class="setting-group">
                <label>Grayscale Conversion</label>
                <select id="grayscale">
                    <option value="yes" selected>Yes (smaller)</option>
                    <option value="no">No (color)</option>
                </select>
            </div>
        </div>
    </div>

    <button class="compress-btn" id="compressBtn">🚀 Optimize PDF (Limited)</button>

    <div class="results" id="results"></div>

    <!-- <div class="alternatives">
        <h3>🔧 Better Solutions for Text PDF Compression</h3>

        <div class="alternative-option">
            <h4>1. Ghostscript (Best - 70-90% reduction)</h4>
            <p>Professional command-line tool. Install from <strong>ghostscript.com</strong> then run:</p>
            <div class="cmd-box">gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH
                -sOutputFile=output.pdf input.pdf</div>
            <p style="margin-top: 8px;">Settings: <strong>/screen</strong> (smallest), <strong>/ebook</strong>
                (recommended), <strong>/printer</strong> (quality)</p>
        </div>

        <div class="alternative-option">
            <h4>2. Online Services (Easy - 30-60% reduction)</h4>
            <p><strong>iLovePDF.com</strong> - Free, no limits | <strong>Smallpdf.com</strong> - 2 free/day |
                <strong>PDF2Go.com</strong> - Free with ads</p>
        </div>

        <div class="alternative-option">
            <h4>3. Adobe Acrobat Pro (Professional)</h4>
            <p>File → Save As Other → Reduced Size PDF or Optimize PDF</p>
        </div>

        <div class="alternative-option">
            <h4>4. QPDF (Advanced - Structure optimization)</h4>
            <p>Free, open-source. Install from <strong>qpdf.sourceforge.io</strong></p>
            <div class="cmd-box">qpdf --linearize --compress-streams=y --object-streams=generate input.pdf output.pdf
            </div>
        </div>
    </div> -->
</div>

<?php include 'footer.php'; ?>