我正在尝试pdf.js库,只想在我的服务器上显示本地pdf文件,而不是示例提供的pdf文件.
<html>
<body>
<canvas id="the-canvas" style="border:1px solid black"></canvas>
<!-- Use latest PDF.js build from Github -->
<script type="text/javascript" src="https://raw.github.com/mozilla/pdf.js/gh-pages/build/pdf.js"></script>
<script type="text/javascript">
//
// NOTE:
// Modifying the URL below to another server will likely *NOT* work. Because of browser
// security restrictions, we have to use a file server with special headers
// (CORS) - most servers don't support cross-origin browser requests.
//
var url = '/test.pdf';
//
// Disable workers to avoid yet another cross-origin issue (workers need the …Run Code Online (Sandbox Code Playgroud)