JSFiddle - React, Tailwind, and code Playground
by dshilkret
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.4.2/mammoth.browser.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document Viewer</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.10.377/pdf.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.4.2/mammoth.browser.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
}
#viewer {
margin-top: 20px;
}
canvas {
border: 1px solid black;
}
</style>
</head>
<body>
<h1>Document Viewer</h1>
<input type="text" id="docUrl" placeholder="Enter URL to PDF or DOCX file" size="50">
<button onclick="loadDocument()">Load Document</button>
<div id="viewer">
<canvas id="pdfCanvas" style="display:none;"></canvas>
<div id="docxContent" style="display:none;"></div>
</div>
<script src="app.js"></script>
</body>
</html>
JavaScript
// Function to get the token (replace with your token acquisition logic)
function getToken() {
// This should return the token acquired from your token generation code.
return...