Sunilsahani commited on
Commit
8a90876
·
verified ·
1 Parent(s): 405bdd9

pdfcompressor.com - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +368 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Compressor
3
- emoji: 🦀
4
- colorFrom: purple
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: compressor
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,368 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>PDF Compressor | Reduce PDF File Size Online</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .dropzone {
11
+ border: 2px dashed #3b82f6;
12
+ transition: all 0.3s ease;
13
+ }
14
+ .dropzone.active {
15
+ border-color: #10b981;
16
+ background-color: #f0f9ff;
17
+ }
18
+ .progress-bar {
19
+ transition: width 0.3s ease;
20
+ }
21
+ .file-item:hover {
22
+ background-color: #f8fafc;
23
+ }
24
+ .tooltip:hover .tooltip-text {
25
+ visibility: visible;
26
+ opacity: 1;
27
+ }
28
+ </style>
29
+ </head>
30
+ <body class="bg-gray-50 min-h-screen">
31
+ <header class="bg-white shadow-sm">
32
+ <div class="container mx-auto px-4 py-4 flex justify-between items-center">
33
+ <div class="flex items-center">
34
+ <i class="fas fa-file-pdf text-red-500 text-2xl mr-2"></i>
35
+ <h1 class="text-xl font-bold text-gray-800">PDF<span class="text-blue-500">Compressor</span></h1>
36
+ </div>
37
+ <nav class="hidden md:flex space-x-6">
38
+ <a href="#" class="text-gray-600 hover:text-blue-500">Home</a>
39
+ <a href="#" class="text-gray-600 hover:text-blue-500">Features</a>
40
+ <a href="#" class="text-gray-600 hover:text-blue-500">Pricing</a>
41
+ <a href="#" class="text-gray-600 hover:text-blue-500">FAQ</a>
42
+ </nav>
43
+ <button class="md:hidden text-gray-600">
44
+ <i class="fas fa-bars text-xl"></i>
45
+ </button>
46
+ </div>
47
+ </header>
48
+
49
+ <main class="container mx-auto px-4 py-8">
50
+ <section class="text-center mb-12">
51
+ <h2 class="text-3xl md:text-4xl font-bold text-gray-800 mb-4">Compress PDF Files Online</h2>
52
+ <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>
53
+ </section>
54
+
55
+ <section class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-8">
56
+ <div id="upload-section" class="text-center">
57
+ <div class="dropzone rounded-lg p-8 mb-6 cursor-pointer" id="dropzone">
58
+ <i class="fas fa-cloud-upload-alt text-blue-500 text-5xl mb-4"></i>
59
+ <h3 class="text-xl font-semibold text-gray-800 mb-2">Drag & Drop your PDF file here</h3>
60
+ <p class="text-gray-500 mb-4">or</p>
61
+ <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">
62
+ Select PDF File
63
+ </label>
64
+ <input type="file" id="file-input" class="hidden" accept=".pdf">
65
+ </div>
66
+ <p class="text-sm text-gray-500">Files are processed securely and deleted after 1 hour</p>
67
+ </div>
68
+
69
+ <div id="processing-section" class="hidden">
70
+ <div class="flex items-center mb-4">
71
+ <div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mr-4">
72
+ <i class="fas fa-cog text-blue-500 text-xl animate-spin"></i>
73
+ </div>
74
+ <div class="flex-1">
75
+ <h4 class="font-medium text-gray-800">Compressing your PDF...</h4>
76
+ <p class="text-sm text-gray-500">This usually takes a few seconds</p>
77
+ </div>
78
+ </div>
79
+ <div class="w-full bg-gray-200 rounded-full h-2.5 mb-6">
80
+ <div id="progress-bar" class="progress-bar bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
81
+ </div>
82
+ </div>
83
+
84
+ <div id="result-section" class="hidden">
85
+ <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">
86
+ <div class="flex items-center mb-4 md:mb-0">
87
+ <div class="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center mr-3">
88
+ <i class="fas fa-check text-green-500"></i>
89
+ </div>
90
+ <div>
91
+ <h4 class="font-medium text-gray-800">Compression successful!</h4>
92
+ <p id="compression-result" class="text-sm text-gray-500">File reduced by 60% (2.4MB to 960KB)</p>
93
+ </div>
94
+ </div>
95
+ <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">
96
+ Download PDF
97
+ </button>
98
+ </div>
99
+
100
+ <div class="border border-gray-200 rounded-lg overflow-hidden">
101
+ <div class="grid grid-cols-12 bg-gray-50 border-b border-gray-200 p-3 font-medium text-gray-700">
102
+ <div class="col-span-6 md:col-span-4">File Name</div>
103
+ <div class="col-span-3 md:col-span-2 text-center">Original Size</div>
104
+ <div class="col-span-3 md:col-span-2 text-center">Compressed</div>
105
+ <div class="hidden md:col-span-2 text-center">Reduction</div>
106
+ <div class="col-span-6 md:col-span-2 text-right">Action</div>
107
+ </div>
108
+ <div id="file-list" class="divide-y divide-gray-200">
109
+ <!-- Files will be added here dynamically -->
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </section>
114
+
115
+ <section class="max-w-4xl mx-auto grid md:grid-cols-3 gap-6 mb-12">
116
+ <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
117
+ <div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mb-4">
118
+ <i class="fas fa-lock text-blue-500"></i>
119
+ </div>
120
+ <h3 class="font-semibold text-lg text-gray-800 mb-2">Secure Processing</h3>
121
+ <p class="text-gray-600">Your files are processed securely and automatically deleted after 1 hour. No one has access to your documents.</p>
122
+ </div>
123
+ <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
124
+ <div class="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mb-4">
125
+ <i class="fas fa-mobile-alt text-purple-500"></i>
126
+ </div>
127
+ <h3 class="font-semibold text-lg text-gray-800 mb-2">Works Everywhere</h3>
128
+ <p class="text-gray-600">Our tool works in all modern browsers on any device. No installation required - just upload and compress.</p>
129
+ </div>
130
+ <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
131
+ <div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4">
132
+ <i class="fas fa-bolt text-green-500"></i>
133
+ </div>
134
+ <h3 class="font-semibold text-lg text-gray-800 mb-2">Fast Compression</h3>
135
+ <p class="text-gray-600">Optimized algorithms compress your PDFs quickly while maintaining good quality. Most files process in seconds.</p>
136
+ </div>
137
+ </section>
138
+
139
+ <section class="max-w-4xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6 mb-12">
140
+ <h2 class="text-2xl font-bold text-gray-800 mb-6">Frequently Asked Questions</h2>
141
+ <div class="space-y-4">
142
+ <div class="border-b border-gray-200 pb-4">
143
+ <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
144
+ <span>Is PDFCompressor free to use?</span>
145
+ <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
146
+ </button>
147
+ <div class="mt-2 text-gray-600 hidden">
148
+ 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.
149
+ </div>
150
+ </div>
151
+ <div class="border-b border-gray-200 pb-4">
152
+ <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
153
+ <span>How does PDF compression work?</span>
154
+ <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
155
+ </button>
156
+ <div class="mt-2 text-gray-600 hidden">
157
+ 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.
158
+ </div>
159
+ </div>
160
+ <div class="border-b border-gray-200 pb-4">
161
+ <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
162
+ <span>Is there a file size limit?</span>
163
+ <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
164
+ </button>
165
+ <div class="mt-2 text-gray-600 hidden">
166
+ 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.
167
+ </div>
168
+ </div>
169
+ <div class="border-b border-gray-200 pb-4">
170
+ <button class="flex justify-between items-center w-full text-left font-medium text-gray-800">
171
+ <span>Are my files secure?</span>
172
+ <i class="fas fa-chevron-down text-gray-500 transition-transform duration-300"></i>
173
+ </button>
174
+ <div class="mt-2 text-gray-600 hidden">
175
+ 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.
176
+ </div>
177
+ </div>
178
+ </div>
179
+ </section>
180
+ </main>
181
+
182
+ <footer class="bg-gray-800 text-white py-8">
183
+ <div class="container mx-auto px-4">
184
+ <div class="grid md:grid-cols-4 gap-8 mb-8">
185
+ <div>
186
+ <h3 class="text-lg font-semibold mb-4">PDFCompressor</h3>
187
+ <p class="text-gray-400">The easiest way to compress PDF files online. Free, secure, and no installation required.</p>
188
+ </div>
189
+ <div>
190
+ <h3 class="text-lg font-semibold mb-4">Quick Links</h3>
191
+ <ul class="space-y-2">
192
+ <li><a href="#" class="text-gray-400 hover:text-white">Home</a></li>
193
+ <li><a href="#" class="text-gray-400 hover:text-white">Features</a></li>
194
+ <li><a href="#" class="text-gray-400 hover:text-white">Pricing</a></li>
195
+ <li><a href="#" class="text-gray-400 hover:text-white">FAQ</a></li>
196
+ </ul>
197
+ </div>
198
+ <div>
199
+ <h3 class="text-lg font-semibold mb-4">Legal</h3>
200
+ <ul class="space-y-2">
201
+ <li><a href="#" class="text-gray-400 hover:text-white">Terms of Service</a></li>
202
+ <li><a href="#" class="text-gray-400 hover:text-white">Privacy Policy</a></li>
203
+ <li><a href="#" class="text-gray-400 hover:text-white">Cookie Policy</a></li>
204
+ </ul>
205
+ </div>
206
+ <div>
207
+ <h3 class="text-lg font-semibold mb-4">Connect</h3>
208
+ <div class="flex space-x-4">
209
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-twitter text-xl"></i></a>
210
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-facebook text-xl"></i></a>
211
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-instagram text-xl"></i></a>
212
+ <a href="#" class="text-gray-400 hover:text-white"><i class="fab fa-linkedin text-xl"></i></a>
213
+ </div>
214
+ </div>
215
+ </div>
216
+ <div class="border-t border-gray-700 pt-6 text-center text-gray-400">
217
+ <p>&copy; 2023 PDFCompressor. All rights reserved.</p>
218
+ </div>
219
+ </div>
220
+ </footer>
221
+
222
+ <script>
223
+ document.addEventListener('DOMContentLoaded', function() {
224
+ // DOM Elements
225
+ const dropzone = document.getElementById('dropzone');
226
+ const fileInput = document.getElementById('file-input');
227
+ const uploadSection = document.getElementById('upload-section');
228
+ const processingSection = document.getElementById('processing-section');
229
+ const resultSection = document.getElementById('result-section');
230
+ const progressBar = document.getElementById('progress-bar');
231
+ const fileList = document.getElementById('file-list');
232
+ const downloadBtn = document.getElementById('download-btn');
233
+ const compressionResult = document.getElementById('compression-result');
234
+
235
+ // FAQ accordion
236
+ const faqButtons = document.querySelectorAll('section:last-of-type button');
237
+ faqButtons.forEach(button => {
238
+ button.addEventListener('click', () => {
239
+ const content = button.nextElementSibling;
240
+ const icon = button.querySelector('i');
241
+
242
+ content.classList.toggle('hidden');
243
+ icon.classList.toggle('rotate-180');
244
+ });
245
+ });
246
+
247
+ // Drag and drop events
248
+ ['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
249
+ dropzone.addEventListener(eventName, preventDefaults, false);
250
+ });
251
+
252
+ function preventDefaults(e) {
253
+ e.preventDefault();
254
+ e.stopPropagation();
255
+ }
256
+
257
+ ['dragenter', 'dragover'].forEach(eventName => {
258
+ dropzone.addEventListener(eventName, highlight, false);
259
+ });
260
+
261
+ ['dragleave', 'drop'].forEach(eventName => {
262
+ dropzone.addEventListener(eventName, unhighlight, false);
263
+ });
264
+
265
+ function highlight() {
266
+ dropzone.classList.add('active');
267
+ }
268
+
269
+ function unhighlight() {
270
+ dropzone.classList.remove('active');
271
+ }
272
+
273
+ dropzone.addEventListener('drop', handleDrop, false);
274
+ fileInput.addEventListener('change', handleFiles);
275
+
276
+ function handleDrop(e) {
277
+ const dt = e.dataTransfer;
278
+ const files = dt.files;
279
+ handleFiles({ target: { files } });
280
+ }
281
+
282
+ function handleFiles(e) {
283
+ const files = e.target.files;
284
+ if (files.length === 0) return;
285
+
286
+ // Only process the first file (for demo)
287
+ const file = files[0];
288
+
289
+ // Check if file is PDF
290
+ if (!file.type.includes('pdf') && !file.name.toLowerCase().endsWith('.pdf')) {
291
+ alert('Please upload a PDF file');
292
+ return;
293
+ }
294
+
295
+ // Show processing section
296
+ uploadSection.classList.add('hidden');
297
+ processingSection.classList.remove('hidden');
298
+
299
+ // Simulate compression progress
300
+ let progress = 0;
301
+ const interval = setInterval(() => {
302
+ progress += Math.random() * 10;
303
+ if (progress > 100) progress = 100;
304
+ progressBar.style.width = `${progress}%`;
305
+
306
+ if (progress === 100) {
307
+ clearInterval(interval);
308
+ setTimeout(showResults, 500, file);
309
+ }
310
+ }, 200);
311
+ }
312
+
313
+ function showResults(file) {
314
+ processingSection.classList.add('hidden');
315
+ resultSection.classList.remove('hidden');
316
+
317
+ // Generate random compression results for demo
318
+ const originalSize = (file.size / (1024 * 1024)).toFixed(1);
319
+ const compressedSize = (file.size * (0.3 + Math.random() * 0.3) / (1024 * 1024)).toFixed(1);
320
+ const reduction = Math.round((1 - (compressedSize / originalSize)) * 100);
321
+
322
+ compressionResult.textContent = `File reduced by ${reduction}% (${originalSize}MB to ${compressedSize}MB)`;
323
+
324
+ // Add file to list
325
+ fileList.innerHTML = `
326
+ <div class="file-item grid grid-cols-12 items-center p-3 hover:bg-gray-50">
327
+ <div class="col-span-6 md:col-span-4 flex items-center">
328
+ <i class="fas fa-file-pdf text-red-500 mr-3"></i>
329
+ <span class="truncate">${file.name}</span>
330
+ </div>
331
+ <div class="col-span-3 md:col-span-2 text-center text-gray-600">${originalSize} MB</div>
332
+ <div class="col-span-3 md:col-span-2 text-center text-gray-600">${compressedSize} MB</div>
333
+ <div class="hidden md:col-span-2 text-center text-green-500 font-medium">${reduction}%</div>
334
+ <div class="col-span-6 md:col-span-2 text-right">
335
+ <button class="text-blue-500 hover:text-blue-700 mr-3 tooltip relative">
336
+ <i class="fas fa-eye"></i>
337
+ <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>
338
+ </button>
339
+ <button class="text-blue-500 hover:text-blue-700 mr-3 tooltip relative">
340
+ <i class="fas fa-redo"></i>
341
+ <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>
342
+ </button>
343
+ <button class="text-blue-500 hover:text-blue-700 tooltip relative">
344
+ <i class="fas fa-trash"></i>
345
+ <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>
346
+ </button>
347
+ </div>
348
+ </div>
349
+ `;
350
+
351
+ // Set up download button
352
+ downloadBtn.addEventListener('click', () => {
353
+ alert('In a real application, this would download the compressed file.');
354
+ });
355
+ }
356
+
357
+ // Reset button (not shown in UI but could be added)
358
+ function resetForm() {
359
+ uploadSection.classList.remove('hidden');
360
+ processingSection.classList.add('hidden');
361
+ resultSection.classList.add('hidden');
362
+ progressBar.style.width = '0%';
363
+ fileInput.value = '';
364
+ }
365
+ });
366
+ </script>
367
+ <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>
368
+ </html>