-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
679 lines (636 loc) · 35.4 KB
/
index.html
File metadata and controls
679 lines (636 loc) · 35.4 KB
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Jarvis PDF Reader: Upload, read, and listen to PDFs with a Jarvis-like voice. Extract text, convert to speech, and manage your documents with AI assistance.">
<title>Jarvis PDF Reader - AI-Powered Document Assistant</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
:root {
--primary: #3b82f6;
--secondary: #1f2937;
--accent: #f97316;
--dark: #111827;
--light: #f3f4f6;
}
body {
background: linear-gradient(135deg, var(--dark) 0%, var(--secondary) 100%);
color: var(--light);
font-family: 'Inter', sans-serif;
overflow-x: hidden;
}
#pdfCanvas {
max-width: 100%;
height: auto;
border: 1px solid #374151;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
transition: transform 0.3s ease;
}
.control-group {
background: rgba(31, 41, 55, 0.7);
backdrop-filter: blur(10px);
border-radius: 12px;
padding: 1.5rem;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
transition: all 0.3s ease;
border: 1px solid rgba(255, 255, 255, 0.05);
}
.control-group:hover {
transform: translateY(-2px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}
#jarvisStatus::before {
content: '';
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
background-color: #22c55e;
margin-right: 10px;
transition: all 0.3s ease;
}
#jarvisStatus.speaking::before {
background-color: var(--accent);
box-shadow: 0 0 12px var(--accent);
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.loader {
border: 4px solid #f3f4f6;
border-top: 4px solid var(--primary);
border-radius: 50%;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
display: none;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loader.active {
display: inline-block;
}
.feature-card {
transition: all 0.3s ease;
}
.feature-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}
.nav-link {
position: relative;
}
.nav-link::after {
content: '';
position: absolute;
bottom: -2px;
left: 0;
width: 0;
height: 2px;
background-color: var(--primary);
transition: width 0.3s ease;
}
.nav-link:hover::after {
width: 100%;
}
.gradient-text {
background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.glass-effect {
background: rgba(255, 255, 255, 0.05);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.1);
}
</style>
</head>
<body class="min-h-screen flex flex-col">
<!-- Navigation -->
<nav class="glass-effect py-4 px-6 sticky top-0 z-50">
<div class="max-w-7xl mx-auto flex justify-between items-center">
<div class="flex items-center space-x-2">
<div class="bg-blue-600 p-2 rounded-lg">
<i class="fas fa-robot text-white text-xl"></i>
</div>
<span class="text-xl font-bold gradient-text">Jarvis PDF Reader</span>
</div>
<div class="hidden md:flex space-x-6">
<a href="#features" class="nav-link text-gray-300 hover:text-white">Features</a>
<a href="#how-it-works" class="nav-link text-gray-300 hover:text-white">How It Works</a>
<a href="#demo" class="nav-link text-gray-300 hover:text-white">Demo</a>
<a href="typing_test.html" class="nav-link text-gray-300 hover:text-white">Typing Test</a>
<a href="convert.html" class="nav-link text-gray-300 hover:text-white">Convert</a>
<a href="notepad.html" class="nav-link text-gray-300 hover:text-white">Note Pad</a>
<a href="#faq" class="nav-link text-gray-300 hover:text-white">FAQ</a>
</div>
<div class="flex items-center space-x-4">
<a href="/pdf_reader_jarvis/indexed" class="bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white font-medium py-2 px-4 rounded-lg transition">
AI Agent Chat <i class="fas fa-arrow-right ml-2"></i>
</a>
<button class="md:hidden text-gray-300 hover:text-white">
<i class="fas fa-bars text-xl"></i>
</button>
</div>
</div>
</nav>
<!-- Hero Section -->
<section class="py-16 px-4 sm:px-6 lg:px-8">
<div class="max-w-7xl mx-auto text-center">
<h1 class="text-4xl sm:text-5xl md:text-6xl font-bold mb-6">
<span class="gradient-text">AI-Powered</span> PDF Reading Experience
</h1>
<p class="text-xl text-gray-300 max-w-3xl mx-auto mb-10">
Transform your documents into interactive, voice-enabled content with our Jarvis-like AI assistant. Listen, extract, and interact with your PDFs like never before.
</p>
<div class="flex flex-wrap justify-center gap-4">
<a href="/pdf_reader_jarvis/pdf_reader" class="bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white font-semibold py-3 px-8 rounded-lg transition transform hover:scale-105">
Try It Now <i class="fas fa-play ml-2"></i>
</a>
<!-- <a href="#demo" class="bg-gradient-to-r from-blue-600 to-purple-600 hover:from-blue-700 hover:to-purple-700 text-white font-semibold py-3 px-8 rounded-lg transition transform hover:scale-105">
Try It Now <i class="fas fa-play ml-2"></i>
</a> -->
<a href="#features" class="bg-gray-700 hover:bg-gray-600 text-white font-semibold py-3 px-8 rounded-lg transition transform hover:scale-105">
Learn More <i class="fas fa-arrow-down ml-2"></i>
</a>
</div>
</div>
</section>
<!-- Features Section -->
<section id="features" class="py-16 px-4 sm:px-6 lg:px-8 bg-gradient-to-b from-gray-900/50 to-gray-900/20">
<div class="max-w-7xl mx-auto">
<h2 class="text-3xl sm:text-4xl font-bold text-center mb-12 gradient-text">Powerful Features</h2>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Feature 1 -->
<div class="feature-card glass-effect p-6 rounded-xl">
<div class="bg-blue-600/20 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
<i class="fas fa-volume-up text-blue-400 text-xl"></i>
</div>
<h3 class="text-xl font-semibold mb-3">Natural Voice Reading</h3>
<p class="text-gray-300">Listen to your documents with our advanced text-to-speech technology featuring a natural, Jarvis-like voice.</p>
</div>
<!-- Feature 2 -->
<div class="feature-card glass-effect p-6 rounded-xl">
<div class="bg-purple-600/20 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
<i class="fas fa-file-export text-purple-400 text-xl"></i>
</div>
<h3 class="text-xl font-semibold mb-3">Text Extraction</h3>
<p class="text-gray-300">Easily extract text from any PDF document for editing, analysis, or further processing.</p>
</div>
<!-- Feature 3 -->
<div class="feature-card glass-effect p-6 rounded-xl">
<div class="bg-green-600/20 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
<i class="fas fa-sliders-h text-green-400 text-xl"></i>
</div>
<h3 class="text-xl font-semibold mb-3">Customizable Voice</h3>
<p class="text-gray-300">Adjust speech rate, pitch, and volume to create your perfect listening experience.</p>
</div>
<!-- Feature 4 -->
<div class="feature-card glass-effect p-6 rounded-xl">
<div class="bg-yellow-600/20 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
<i class="fas fa-search text-yellow-400 text-xl"></i>
</div>
<h3 class="text-xl font-semibold mb-3">Smart Navigation</h3>
<p class="text-gray-300">Quickly navigate through pages with intuitive controls and zoom functionality.</p>
</div>
<!-- Feature 5 -->
<div class="feature-card glass-effect p-6 rounded-xl">
<div class="bg-red-600/20 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
<i class="fas fa-download text-red-400 text-xl"></i>
</div>
<h3 class="text-xl font-semibold mb-3">Export Options</h3>
<p class="text-gray-300">Download extracted text for offline use or further processing in other applications.</p>
</div>
<!-- Feature 6 -->
<div class="feature-card glass-effect p-6 rounded-xl">
<div class="bg-pink-600/20 p-3 rounded-full w-12 h-12 flex items-center justify-center mb-4">
<i class="fas fa-robot text-pink-400 text-xl"></i>
</div>
<h3 class="text-xl font-semibold mb-3">AI Integration</h3>
<p class="text-gray-300">Connect with our AI agent for advanced document analysis and interactive Q&A.</p>
</div>
</div>
</div>
</section>
<!-- How It Works Section -->
<section id="how-it-works" class="py-16 px-4 sm:px-6 lg:px-8">
<div class="max-w-7xl mx-auto">
<h2 class="text-3xl sm:text-4xl font-bold text-center mb-12 gradient-text">How It Works</h2>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Step 1 -->
<div class="flex flex-col items-center text-center">
<div class="bg-blue-600/20 p-4 rounded-full w-16 h-16 flex items-center justify-center mb-4 text-blue-400 text-2xl font-bold">1</div>
<h3 class="text-xl font-semibold mb-3">Upload Your PDF</h3>
<p class="text-gray-300">Simply drag and drop your PDF file or click to browse your device.</p>
</div>
<!-- Step 2 -->
<div class="flex flex-col items-center text-center">
<div class="bg-purple-600/20 p-4 rounded-full w-16 h-16 flex items-center justify-center mb-4 text-purple-400 text-2xl font-bold">2</div>
<h3 class="text-xl font-semibold mb-3">Preview & Extract</h3>
<p class="text-gray-300">View your document and extract all text with a single click.</p>
</div>
<!-- Step 3 -->
<div class="flex flex-col items-center text-center">
<div class="bg-green-600/20 p-4 rounded-full w-16 h-16 flex items-center justify-center mb-4 text-green-400 text-2xl font-bold">3</div>
<h3 class="text-xl font-semibold mb-3">Listen or Download</h3>
<p class="text-gray-300">Have Jarvis read aloud or download the text for offline use.</p>
</div>
</div>
</div>
</section>
<!-- Demo Section -->
<section id="demo" class="py-16 px-4 sm:px-6 lg:px-8 bg-gradient-to-b from-gray-900/20 to-gray-900/50">
<div class="max-w-7xl mx-auto">
<h2 class="text-3xl sm:text-4xl font-bold text-center mb-12 gradient-text">Try It Yourself</h2>
<div class="w-full bg-gray-900 rounded-2xl shadow-2xl p-6 sm:p-8 lg:p-10">
<header class="flex items-center justify-between mb-8">
<h1 class="text-2xl sm:text-3xl font-bold text-blue-400">Jarvis PDF Reader</h1>
<div class="text-sm text-gray-400">Powered by xAI</div>
</header>
<!-- File Input and Controls -->
<div class="control-group mb-8">
<div class="flex flex-col items-center mb-6">
<label for="pdfInput" class="block text-sm font-medium mb-2">Upload PDF</label>
<input type="file" id="pdfInput" accept=".pdf" class="w-full max-w-md p-3 bg-gray-800 rounded-lg text-white focus:ring-2 focus:ring-blue-500 transition file:mr-4 file:py-2 file:px-4 file:rounded-md file:bg-blue-600 file:text-white file:border-0 hover:file:bg-blue-700" aria-label="Upload PDF file">
<div class="flex flex-wrap gap-4 justify-center mt-6">
<button id="readBtn" class="bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-6 rounded-lg transition flex items-center gap-2" disabled>
<span>Read Aloud</span>
<span id="readLoader" class="loader"></span>
</button>
<button id="stopBtn" class="bg-red-600 hover:bg-red-700 text-white font-semibold py-2 px-6 rounded-lg transition" disabled>Stop Reading</button>
<button id="downloadBtn" class="bg-green-600 hover:bg-green-700 text-white font-semibold py-2 px-6 rounded-lg transition" disabled>Download Text</button>
<a href="/pdf_reader_jarvis/indexed">
<button class="bg-gradient-to-r from-purple-600 to-pink-600 hover:from-purple-700 hover:to-pink-700 text-white font-semibold py-2 px-6 rounded-lg transition">
AI Agent Chat <i class="fas fa-comment ml-2"></i>
</button>
</a>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4 justify-center">
<div class="flex items-center gap-3">
<label for="speechRate" class="text-sm font-medium">Speech Rate</label>
<input type="range" id="speechRate" min="0.5" max="2" step="0.1" value="1" class="w-full accent-blue-500" aria-label="Adjust speech rate">
<span id="rateValue" class="text-sm w-10 text-center">1.0</span>
</div>
<div class="flex items-center gap-3">
<label for="speechPitch" class="text-sm font-medium">Speech Pitch</label>
<input type="range" id="speechPitch" min="0" max="2" step="0.1" value="0.9" class="w-full accent-blue-500" aria-label="Adjust speech pitch">
<span id="pitchValue" class="text-sm w-10 text-center">0.9</span>
</div>
</div>
<div id="jarvisStatus" class="mt-6 text-green-400 text-center" role="status">Initializing Jarvis...</div>
<div id="errorMessage" class="mt-4 text-red-400 text-center hidden" role="alert"></div>
</div>
<!-- PDF Display and Text Output -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div class="control-group">
<h2 class="text-xl sm:text-2xl font-semibold mb-4">PDF Preview</h2>
<div class="flex flex-wrap justify-between items-center mb-4 gap-4">
<div class="flex gap-2">
<button id="prevPage" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg transition" disabled aria-label="Previous page">Previous</button>
<button id="nextPage" class="bg-gray-700 hover:bg-gray-600 text-white py-2 px-4 rounded-lg transition" disabled aria-label="Next page">Next</button>
</div>
<div class="flex items-center gap-3">
<label for="zoomLevel" class="text-sm font-medium">Zoom</label>
<input type="range" id="zoomLevel" min="0.5" max="2" step="0.1" value="1.5" class="w-32 accent-blue-500" aria-label="Adjust zoom level">
<span id="zoomValue" class="text-sm w-10 text-center">1.5</span>
</div>
</div>
<div class="relative">
<canvas id="pdfCanvas" class="w-full"></canvas>
<div id="pdfLoader" class="loader absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"></div>
</div>
<div class="text-center mt-4 text-sm">
Page <span id="currentPage">1</span> of <span id="totalPages">1</span>
</div>
</div>
<div class="control-group">
<h2 class="text-xl sm:text-2xl font-semibold mb-4">Extracted Text</h2>
<textarea id="pdfText" class="w-full h-96 bg-gray-800 rounded-lg p-4 text-white focus:ring-2 focus:ring-blue-500 resize-none" readonly aria-label="Extracted text from PDF"></textarea>
</div>
</div>
</div>
</div>
</section>
<!-- FAQ Section -->
<section id="faq" class="py-16 px-4 sm:px-6 lg:px-8">
<div class="max-w-7xl mx-auto">
<h2 class="text-3xl sm:text-4xl font-bold text-center mb-12 gradient-text">Frequently Asked Questions</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- FAQ Item 1 -->
<div class="control-group p-6">
<h3 class="text-xl font-semibold mb-3 flex items-center">
<i class="fas fa-question-circle text-blue-400 mr-3"></i>
What types of PDFs can I upload?
</h3>
<p class="text-gray-300">You can upload any standard PDF document, including text-based PDFs, scanned documents (with OCR capability), and password-protected PDFs (if you know the password).</p>
</div>
<!-- FAQ Item 2 -->
<div class="control-group p-6">
<h3 class="text-xl font-semibold mb-3 flex items-center">
<i class="fas fa-question-circle text-purple-400 mr-3"></i>
Is there a file size limit?
</h3>
<p class="text-gray-300">Currently, we support PDFs up to 50MB in size. For larger documents, consider splitting them into smaller files for better performance.</p>
</div>
<!-- FAQ Item 3 -->
<div class="control-group p-6">
<h3 class="text-xl font-semibold mb-3 flex items-center">
<i class="fas fa-question-circle text-green-400 mr-3"></i>
How accurate is the text extraction?
</h3>
<p class="text-gray-300">Our text extraction is highly accurate for digital PDFs (95-100%). For scanned documents, accuracy depends on scan quality but typically ranges from 85-95% with our OCR technology.</p>
</div>
<!-- FAQ Item 4 -->
<div class="control-group p-6">
<h3 class="text-xl font-semibold mb-3 flex items-center">
<i class="fas fa-question-circle text-yellow-400 mr-3"></i>
Can I save my reading progress?
</h3>
<p class="text-gray-300">Currently, the app doesn't automatically save progress, but you can note the page number or download the extracted text to continue later.</p>
</div>
<!-- FAQ Item 5 -->
<div class="control-group p-6">
<h3 class="text-xl font-semibold mb-3 flex items-center">
<i class="fas fa-question-circle text-red-400 mr-3"></i>
Is my data secure?
</h3>
<p class="text-gray-300">Absolutely! All processing happens in your browser. Your documents never leave your device unless you choose to download or share them.</p>
</div>
<!-- FAQ Item 6 -->
<div class="control-group p-6">
<h3 class="text-xl font-semibold mb-3 flex items-center">
<i class="fas fa-question-circle text-pink-400 mr-3"></i>
What browsers are supported?
</h3>
<p class="text-gray-300">Jarvis PDF Reader works on all modern browsers including Chrome, Firefox, Safari, and Edge. For best performance, we recommend using the latest version of Chrome.</p>
</div>
</div>
</div>
</section>
<!-- CTA Section -->
<section class="py-16 px-4 sm:px-6 lg:px-8 bg-gradient-to-r from-blue-900/50 to-purple-900/50">
<div class="max-w-4xl mx-auto text-center">
<h2 class="text-3xl sm:text-4xl font-bold mb-6">Ready to Transform Your PDF Experience?</h2>
<p class="text-xl text-gray-300 mb-8">Join thousands of users who are already enjoying AI-powered document interaction.</p>
<div class="flex flex-wrap justify-center gap-4">
<a href="#demo" class="bg-white hover:bg-gray-100 text-gray-900 font-semibold py-3 px-8 rounded-lg transition transform hover:scale-105">
Try It Free Now <i class="fas fa-arrow-right ml-2"></i>
</a>
<a href="#features" class="bg-transparent hover:bg-white/10 text-white border border-white font-semibold py-3 px-8 rounded-lg transition transform hover:scale-105">
Learn More <i class="fas fa-book-open ml-2"></i>
</a>
</div>
</div>
</section>
<!-- Footer -->
<footer class="py-8 px-4 sm:px-6 lg:px-8 bg-gray-900/80">
<div class="max-w-7xl mx-auto">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<div class="flex items-center space-x-2 mb-4">
<div class="bg-blue-600 p-2 rounded-lg">
<i class="fas fa-robot text-white text-xl"></i>
</div>
<span class="text-xl font-bold gradient-text">Jarvis PDF</span>
</div>
<p class="text-gray-400">AI-powered document interaction for the modern user.</p>
<div class="flex space-x-4 mt-4">
<a href="#" class="text-gray-400 hover:text-white transition"><i class="fab fa-twitter"></i></a>
<a href="#" class="text-gray-400 hover:text-white transition"><i class="fab fa-github"></i></a>
<a href="#" class="text-gray-400 hover:text-white transition"><i class="fab fa-linkedin"></i></a>
</div>
</div>
<div>
<h3 class="text-lg font-semibold mb-4">Product</h3>
<ul class="space-y-2">
<li><a href="#features" class="text-gray-400 hover:text-white transition">Features</a></li>
<li><a href="#how-it-works" class="text-gray-400 hover:text-white transition">How It Works</a></li>
<li><a href="#demo" class="text-gray-400 hover:text-white transition">Demo</a></li>
<li> <a href="typing_test.html" class="text-gray-400 hover:text-white transition">Typing Test</a></li>
<li> <a href="convert.html" class="text-gray-400 hover:text-white transition">Convert</a></li>
<li><a href="/pdf_reader_jarvis/indexed" class="text-gray-400 hover:text-white transition">AI Agent</a></li>
</ul>
</div>
<div>
<h3 class="text-lg font-semibold mb-4">Resources</h3>
<ul class="space-y-2">
<li><a href="#faq" class="text-gray-400 hover:text-white transition">FAQ</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Documentation</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">API</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Blog</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 transition">Privacy Policy</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Terms of Service</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Cookie Policy</a></li>
</ul>
</div>
</div>
<div class="border-t border-gray-800 mt-8 pt-8 text-center text-gray-500 text-sm">
<p>© 2023 Jarvis PDF Reader. All rights reserved. Powered by xAI technologies.</p>
</div>
</div>
</footer>
<script>
// Initialize PDF.js
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.worker.min.js';
const pdfInput = document.getElementById('pdfInput');
const pdfCanvas = document.getElementById('pdfCanvas');
const pdfText = document.getElementById('pdfText');
const readBtn = document.getElementById('readBtn');
const stopBtn = document.getElementById('stopBtn');
const downloadBtn = document.getElementById('downloadBtn');
const prevPage = document.getElementById('prevPage');
const nextPage = document.getElementById('nextPage');
const zoomLevel = document.getElementById('zoomLevel');
const zoomValue = document.getElementById('zoomValue');
const currentPageSpan = document.getElementById('currentPage');
const totalPagesSpan = document.getElementById('totalPages');
const speechRate = document.getElementById('speechRate');
const rateValue = document.getElementById('rateValue');
const speechPitch = document.getElementById('speechPitch');
const pitchValue = document.getElementById('pitchValue');
const jarvisStatus = document.getElementById('jarvisStatus');
const errorMessage = document.getElementById('errorMessage');
const pdfLoader = document.getElementById('pdfLoader');
const readLoader = document.getElementById('readLoader');
let synth = window.speechSynthesis;
let utterance = null;
let pdfDoc = null;
let currentPageNum = 1;
// Helper to show errors
function showError(msg) {
errorMessage.textContent = msg;
errorMessage.classList.remove('hidden');
setTimeout(() => errorMessage.classList.add('hidden'), 5000);
}
// Update slider values
speechRate.addEventListener('input', () => rateValue.textContent = parseFloat(speechRate.value).toFixed(1));
speechPitch.addEventListener('input', () => pitchValue.textContent = parseFloat(speechPitch.value).toFixed(1));
zoomLevel.addEventListener('input', () => {
zoomValue.textContent = parseFloat(zoomLevel.value).toFixed(1);
if (pdfDoc) renderPage(currentPageNum, parseFloat(zoomLevel.value));
});
// Render PDF page
async function renderPage(pageNum, scale) {
try {
pdfLoader.classList.add('active');
const page = await pdfDoc.getPage(pageNum);
const viewport = page.getViewport({ scale });
pdfCanvas.height = viewport.height;
pdfCanvas.width = viewport.width;
const context = pdfCanvas.getContext('2d');
await page.render({ canvasContext: context, viewport }).promise;
currentPageSpan.textContent = pageNum;
prevPage.disabled = pageNum === 1;
nextPage.disabled = pageNum === pdfDoc.numPages;
} catch (error) {
showError('Error rendering page: ' + error.message);
} finally {
pdfLoader.classList.remove('active');
}
}
// Load and process PDF
pdfInput.addEventListener('change', async (e) => {
const file = e.target.files[0];
if (!file) return;
if (!file.type.includes('pdf')) {
showError('Please upload a valid PDF file.');
return;
}
try {
pdfLoader.classList.add('active');
const arrayBuffer = await file.arrayBuffer();
pdfDoc = await pdfjsLib.getDocument(arrayBuffer).promise;
totalPagesSpan.textContent = pdfDoc.numPages;
currentPageNum = 1;
await renderPage(currentPageNum, parseFloat(zoomLevel.value));
// Extract text
let fullText = '';
for (let i = 1; i <= pdfDoc.numPages; i++) {
const page = await pdfDoc.getPage(i);
const textContent = await page.getTextContent();
fullText += textContent.items.map(item => item.str).join(' ') + '\n';
}
pdfText.value = fullText;
readBtn.disabled = false;
downloadBtn.disabled = false;
prevPage.disabled = currentPageNum === 1;
nextPage.disabled = currentPageNum === pdfDoc.numPages;
jarvisStatus.textContent = 'PDF loaded. Ready to read.';
} catch (error) {
showError('Error loading PDF: ' + error.message);
} finally {
pdfLoader.classList.remove('active');
}
});
// Page navigation
prevPage.addEventListener('click', () => {
if (pdfDoc && currentPageNum > 1) {
currentPageNum--;
renderPage(currentPageNum, parseFloat(zoomLevel.value));
}
});
nextPage.addEventListener('click', () => {
if (pdfDoc && currentPageNum < pdfDoc.numPages) {
currentPageNum++;
renderPage(currentPageNum, parseFloat(zoomLevel.value));
}
});
// Read text aloud
readBtn.addEventListener('click', () => {
if (pdfText.value && !synth.speaking) {
readLoader.classList.add('active');
utterance = new SpeechSynthesisUtterance(pdfText.value);
utterance.rate = parseFloat(speechRate.value);
utterance.pitch = parseFloat(speechPitch.value);
utterance.volume = 1.0;
const voices = synth.getVoices();
const jarvisVoice = voices.find(voice => voice.name.includes('Male') || voice.name.includes('Daniel') || voice.name.includes('Google US English'));
if (jarvisVoice) utterance.voice = jarvisVoice;
else showError('Jarvis-like voice not found. Using default voice.');
utterance.onstart = () => {
jarvisStatus.textContent = 'Jarvis is reading...';
jarvisStatus.classList.add('speaking');
readLoader.classList.remove('active');
stopBtn.disabled = false;
};
utterance.onend = () => {
jarvisStatus.textContent = 'Jarvis is ready';
jarvisStatus.classList.remove('speaking');
stopBtn.disabled = true;
};
utterance.onerror = (event) => {
showError('Speech error: ' + event.error);
jarvisStatus.classList.remove('speaking');
stopBtn.disabled = true;
};
synth.speak(utterance);
}
});
// Stop reading
stopBtn.addEventListener('click', () => {
if (synth.speaking) {
synth.cancel();
jarvisStatus.textContent = 'Jarvis is ready';
jarvisStatus.classList.remove('speaking');
stopBtn.disabled = true;
}
});
// Download extracted text
downloadBtn.addEventListener('click', () => {
if (pdfText.value) {
const blob = new Blob([pdfText.value], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'extracted_text.txt';
a.click();
URL.revokeObjectURL(url);
}
});
// Ensure voices are loaded
synth.onvoiceschanged = () => {
const voices = synth.getVoices();
if (voices.length > 0) {
jarvisStatus.textContent = 'Jarvis is ready';
readBtn.disabled = pdfText.value === '';
}
};
// Initial button states
readBtn.disabled = true;
stopBtn.disabled = true;
downloadBtn.disabled = true;
prevPage.disabled = true;
nextPage.disabled = true;
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
</script>
</body>
</html>