File size: 21,009 Bytes
8a90876
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PDF Compressor | Reduce PDF File Size Online</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .dropzone {
            border: 2px dashed #3b82f6;
            transition: all 0.3s ease;
        }
        .dropzone.active {
            border-color: #10b981;
            background-color: #f0f9ff;
        }
        .progress-bar {
            transition: width 0.3s ease;
        }
        .file-item:hover {
            background-color: #f8fafc;
        }
        .tooltip:hover .tooltip-text {
            visibility: visible;
            opacity: 1;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <header class="bg-white shadow-sm">
        <div class="container mx-auto px-4 py-4 flex justify-between items-center">
            <div class="flex items-center">
                <i class="fas fa-file-pdf text-red-500 text-2xl mr-2"></i>
                <h1 class="text-xl font-bold text-gray-800">PDF<span class="text-blue-500">Compressor</span></h1>
            </div>
            <nav class="hidden md:flex space-x-6">
                <a href="#" class="text-gray-600 hover:text-blue-500">Home</a>
                <a href="#" class="text-gray-600 hover:text-blue-500">Features</a>
                <a href="#" class="text-gray-600 hover:text-blue-500">Pricing</a>
                <a href="#" class="text-gray-600 hover:text-blue-500">FAQ</a>
            </nav>
            <button class="md:hidden text-gray-600">
                <i class="fas fa-bars text-xl"></i>
            </button>
        </div>
    </header>

    <main class="container mx-auto px-4 py-8">
        <section class="text-center mb-12">
            <h2 class="text-3xl md:text-4xl font-bold text-gray-800 mb-4">Compress PDF Files Online</h2>
            <p class="text-gray-600 max-w-2xl mx-auto">Reduce the size of your PDF files without losing quality. Our tool is free, secure, and works on any device.</p>
        </section>

        <section class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8">
            <div id="upload-section" class="text-center">
                <div class="dropzone rounded-lg p-8 mb-6 cursor-pointer" id="dropzone">
                    <i class="fas fa-cloud-upload-alt text-blue-500 text-5xl mb-4"></i>
                    <h3 class="text-xl font-semibold text-gray-800 mb-2">Drag & Drop your PDF file here</h3>
                    <p class="text-gray-500 mb-4">or</p>
                    <label for="file-input" class="bg-blue-500 hover:bg-blue-600 text-white font-medium py-2 px-6 rounded-full cursor-pointer transition duration-300">
                        Select PDF File
                    </label>
                    <input type="file" id="file-input" class="hidden" accept=".pdf">
                </div>
                <p class="text-sm text-gray-500">Files are processed securely and deleted after 1 hour</p>
            </div>

            <div id="processing-section" class="hidden">
                <div class="flex items-center mb-4">
                    <div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mr-4">
                        <i class="fas fa-cog text-blue-500 text-xl animate-spin"></i>
                    </div>
                    <div class="flex-1">
                        <h4 class="font-medium text-gray-800">Compressing your PDF...</h4>
                        <p class="text-sm text-gray-500">This usually takes a few seconds</p>
                    </div>
                </div>
                <div class="w-full bg-gray-200 rounded-full h-2.5 mb-6">
                    <div id="progress-bar" class="progress-bar bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
                </div>
            </div>

            <div id="result-section" class="hidden">
                <div class="flex flex-col md:flex-row items-center justify-between bg-green-50 border border-green-200 rounded-lg p-4 mb-6">
                    <div class="flex items-center mb-4 md:mb-0">
                        <div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center mr-3">
                            <i class="fas fa-check text-green-500"></i>
                        </div>
                        <div>
                            <h4 class="font-medium text-gray-800">Compression successful!</h4>
                            <p id="compression-result" class="text-sm text-gray-500">File reduced by 60% (2.4MB to 960KB)</p>
                        </div>
                    </div>
                    <button id="download-btn" class="bg-green-500 hover:bg-green-600 text-white font-medium py-2 px-6 rounded-full transition duration-300">
                        Download PDF
                    </button>
                </div>

                <div class="border border-gray-200 rounded-lg overflow-hidden">
                    <div class="grid grid-cols-12 bg-gray-50 border-b border-gray-200 p-3 font-medium text-gray-700">
                        <div class="col-span-6 md:col-span-4">File Name</div>
                        <div class="col-span-3 md:col-span-2 text-center">Original Size</div>
                        <div class="col-span-3 md:col-span-2 text-center">Compressed</div>
                        <div class="hidden md:col-span-2 text-center">Reduction</div>
                        <div class="col-span-6 md:col-span-2 text-right">Action</div>
                    </div>
                    <div id="file-list" class="divide-y divide-gray-200">
                        <!-- Files will be added here dynamically -->
                    </div>
                </div>
            </div>
        </section>

        <section class="max-w-4xl mx-auto grid md:grid-cols-3 gap-6 mb-12">
            <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                <div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4">
                    <i class="fas fa-lock text-blue-500"></i>
                </div>
                <h3 class="font-semibold text-lg text-gray-800 mb-2">Secure Processing</h3>
                <p class="text-gray-600">Your files are processed securely and automatically deleted after 1 hour. No one has access to your documents.</p>
            </div>
            <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                <div class="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mb-4">
                    <i class="fas fa-mobile-alt text-purple-500"></i>
                </div>
                <h3 class="font-semibold text-lg text-gray-800 mb-2">Works Everywhere</h3>
                <p class="text-gray-600">Our tool works in all modern browsers on any device. No installation required - just upload and compress.</p>
            </div>
            <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                <div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4">
                    <i class="fas fa-bolt text-green-500"></i>
                </div>
                <h3 class="font-semibold text-lg text-gray-800 mb-2">Fast Compression</h3>
                <p class="text-gray-600">Optimized algorithms compress your PDFs quickly while maintaining good quality. Most files process in seconds.</p>
            </div>
        </section>

        <section class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-12">
            <h2 class="text-2xl font-bold text-gray-800 mb-6">Frequently Asked Questions</h2>
            <div class="space-y-4">
                <div class="border-b border-gray-200 pb-4">
                    <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
                        <span>Is PDFCompressor free to use?</span>
                        <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
                    </button>
                    <div class="mt-2 text-gray-600 hidden">
                        Yes, our basic PDF compression service is completely free to use with no hidden charges. For advanced features and higher compression limits, we offer premium plans.
                    </div>
                </div>
                <div class="border-b border-gray-200 pb-4">
                    <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
                        <span>How does PDF compression work?</span>
                        <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
                    </button>
                    <div class="mt-2 text-gray-600 hidden">
                        Our tool uses advanced algorithms to optimize PDF files by removing redundant data, compressing images, and restructuring the document for smaller file size while maintaining visual quality.
                    </div>
                </div>
                <div class="border-b border-gray-200 pb-4">
                    <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
                        <span>Is there a file size limit?</span>
                        <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
                    </button>
                    <div class="mt-2 text-gray-600 hidden">
                        The free version allows files up to 50MB. Premium users can compress files up to 200MB. If you need to compress larger files, consider splitting them into smaller parts.
                    </div>
                </div>
                <div class="border-b border-gray-200 pb-4">
                    <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
                        <span>Are my files secure?</span>
                        <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
                    </button>
                    <div class="mt-2 text-gray-600 hidden">
                        Absolutely. We use SSL encryption for all file transfers, and your documents are automatically deleted from our servers after 1 hour. We never store or share your files.
                    </div>
                </div>
            </div>
        </section>
    </main>

    <footer class="bg-gray-800 text-white py-8">
        <div class="container mx-auto px-4">
            <div class="grid md:grid-cols-4 gap-8 mb-8">
                <div>
                    <h3 class="text-lg font-semibold mb-4">PDFCompressor</h3>
                    <p class="text-gray-400">The easiest way to compress PDF files online. Free, secure, and no installation required.</p>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">Quick Links</h3>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Home</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Features</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Pricing</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">FAQ</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">Legal</h3>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Terms of Service</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Privacy Policy</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Cookie Policy</a></li>
                    </ul>
                </div>
                <div>
                    <h3 class="text-lg font-semibold mb-4">Connect</h3>
                    <div class="flex space-x-4">
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter text-xl"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook text-xl"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram text-xl"></i></a>
                        <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin text-xl"></i></a>
                    </div>
                </div>
            </div>
            <div class="border-t border-gray-700 pt-6 text-center text-gray-400">
                <p>&copy; 2023 PDFCompressor. All rights reserved.</p>
            </div>
        </div>
    </footer>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // DOM Elements
            const dropzone = document.getElementById('dropzone');
            const fileInput = document.getElementById('file-input');
            const uploadSection = document.getElementById('upload-section');
            const processingSection = document.getElementById('processing-section');
            const resultSection = document.getElementById('result-section');
            const progressBar = document.getElementById('progress-bar');
            const fileList = document.getElementById('file-list');
            const downloadBtn = document.getElementById('download-btn');
            const compressionResult = document.getElementById('compression-result');
            
            // FAQ accordion
            const faqButtons = document.querySelectorAll('section:last-of-type button');
            faqButtons.forEach(button => {
                button.addEventListener('click', () => {
                    const content = button.nextElementSibling;
                    const icon = button.querySelector('i');
                    
                    content.classList.toggle('hidden');
                    icon.classList.toggle('rotate-180');
                });
            });

            // Drag and drop events
            ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
                dropzone.addEventListener(eventName, preventDefaults, false);
            });

            function preventDefaults(e) {
                e.preventDefault();
                e.stopPropagation();
            }

            ['dragenter', 'dragover'].forEach(eventName => {
                dropzone.addEventListener(eventName, highlight, false);
            });

            ['dragleave', 'drop'].forEach(eventName => {
                dropzone.addEventListener(eventName, unhighlight, false);
            });

            function highlight() {
                dropzone.classList.add('active');
            }

            function unhighlight() {
                dropzone.classList.remove('active');
            }

            dropzone.addEventListener('drop', handleDrop, false);
            fileInput.addEventListener('change', handleFiles);

            function handleDrop(e) {
                const dt = e.dataTransfer;
                const files = dt.files;
                handleFiles({ target: { files } });
            }

            function handleFiles(e) {
                const files = e.target.files;
                if (files.length === 0) return;
                
                // Only process the first file (for demo)
                const file = files[0];
                
                // Check if file is PDF
                if (!file.type.includes('pdf') && !file.name.toLowerCase().endsWith('.pdf')) {
                    alert('Please upload a PDF file');
                    return;
                }
                
                // Show processing section
                uploadSection.classList.add('hidden');
                processingSection.classList.remove('hidden');
                
                // Simulate compression progress
                let progress = 0;
                const interval = setInterval(() => {
                    progress += Math.random() * 10;
                    if (progress > 100) progress = 100;
                    progressBar.style.width = `${progress}%`;
                    
                    if (progress === 100) {
                        clearInterval(interval);
                        setTimeout(showResults, 500, file);
                    }
                }, 200);
            }
            
            function showResults(file) {
                processingSection.classList.add('hidden');
                resultSection.classList.remove('hidden');
                
                // Generate random compression results for demo
                const originalSize = (file.size / (1024 * 1024)).toFixed(1);
                const compressedSize = (file.size * (0.3 + Math.random() * 0.3) / (1024 * 1024)).toFixed(1);
                const reduction = Math.round((1 - (compressedSize / originalSize)) * 100);
                
                compressionResult.textContent = `File reduced by ${reduction}% (${originalSize}MB to ${compressedSize}MB)`;
                
                // Add file to list
                fileList.innerHTML = `
                    <div class="file-item grid grid-cols-12 items-center p-3 hover:bg-gray-50">
                        <div class="col-span-6 md:col-span-4 flex items-center">
                            <i class="fas fa-file-pdf text-red-500 mr-3"></i>
                            <span class="truncate">${file.name}</span>
                        </div>
                        <div class="col-span-3 md:col-span-2 text-center text-gray-600">${originalSize} MB</div>
                        <div class="col-span-3 md:col-span-2 text-center text-gray-600">${compressedSize} MB</div>
                        <div class="hidden md:col-span-2 text-center text-green-500 font-medium">${reduction}%</div>
                        <div class="col-span-6 md:col-span-2 text-right">
                            <button class="text-blue-500 hover:text-blue-700 mr-3 tooltip relative">
                                <i class="fas fa-eye"></i>
                                <span class="tooltip-text absolute z-10 w-24 bg-gray-800 text-white text-xs py-1 px-2 rounded-md -bottom-8 left-1/2 transform -translate-x-1/2 opacity-0 transition-opacity">Preview</span>
                            </button>
                            <button class="text-blue-500 hover:text-blue-700 mr-3 tooltip relative">
                                <i class="fas fa-redo"></i>
                                <span class="tooltip-text absolute z-10 w-24 bg-gray-800 text-white text-xs py-1 px-2 rounded-md -bottom-8 left-1/2 transform -translate-x-1/2 opacity-0 transition-opacity">Recompress</span>
                            </button>
                            <button class="text-blue-500 hover:text-blue-700 tooltip relative">
                                <i class="fas fa-trash"></i>
                                <span class="tooltip-text absolute z-10 w-24 bg-gray-800 text-white text-xs py-1 px-2 rounded-md -bottom-8 left-1/2 transform -translate-x-1/2 opacity-0 transition-opacity">Remove</span>
                            </button>
                        </div>
                    </div>
                `;
                
                // Set up download button
                downloadBtn.addEventListener('click', () => {
                    alert('In a real application, this would download the compressed file.');
                });
            }
            
            // Reset button (not shown in UI but could be added)
            function resetForm() {
                uploadSection.classList.remove('hidden');
                processingSection.classList.add('hidden');
                resultSection.classList.add('hidden');
                progressBar.style.width = '0%';
                fileInput.value = '';
            }
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Sunilsahani/compressor" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>