pdf-magic-viewer / index.html
Deepdomarcio's picture
crie uma pagina html reponsive que exiba o conteudo de um arquivo pdf como se fosse uma pagina html. por exemplo o codigo a vir parametrizado o arquivo pdf e ao abrir a pagina esse arquivo ser exibido direto sem nehuma pergunta adicional
8b0066f verified
Raw History Blame Contribute Delete
2.47 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PDF Magic Viewer</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@3.4.120/build/pdf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
</head>
<body class="bg-gray-50">
<custom-navbar></custom-navbar>
<main class="container mx-auto px-4 py-8">
<div class="flex justify-between items-center mb-6">
<h1 class="text-3xl font-bold text-gray-800">Document Viewer</h1>
<div class="flex gap-2">
<button id="zoomIn" class="p-2 rounded-full bg-gray-200 hover:bg-gray-300 transition">
<i data-feather="zoom-in"></i>
</button>
<button id="zoomOut" class="p-2 rounded-full bg-gray-200 hover:bg-gray-300 transition">
<i data-feather="zoom-out"></i>
</button>
<button id="prevPage" class="p-2 rounded-full bg-gray-200 hover:bg-gray-300 transition">
<i data-feather="chevron-left"></i>
</button>
<span id="pageNum" class="px-4 py-2 text-gray-700">0 / 0</span>
<button id="nextPage" class="p-2 rounded-full bg-gray-200 hover:bg-gray-300 transition">
<i data-feather="chevron-right"></i>
</button>
</div>
</div>
<div class="bg-white rounded-lg shadow-lg overflow-hidden">
<div id="pdfViewer" class="w-full overflow-auto">
<canvas id="pdfCanvas" class="mx-auto"></canvas>
</div>
</div>
</main>
<custom-footer></custom-footer>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
// Get PDF file from URL parameter
const urlParams = new URLSearchParams(window.location.search);
const pdfUrl = urlParams.get('pdf') || 'default.pdf';
// Initialize PDF viewer
loadPDF(pdfUrl);
</script>
<script src="https://deepsite.hf.co/deepsite-badge.js"></script>
</body>
</html>