I am trying to integrate PDF.js
in my website, but am unable to get it done correctly.
This is what the screen shows:
I can not see the PDF file on the screen, but when I press Print
, the print menu does show the PDF file in it. Other functionality is working fine.
This is my code:
[[HTML HERE downloaded from source of PDF.JS]]
<!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="<?php echo JS_LIB_FOLDER; ?>pdfjs/web/locale/locale.properties"/>
<?php
echo $this->Html->css(JS_LIB_FOLDER . 'pdfjs/web/viewer.css');
echo $this->Html->script(JS_LIB_FOLDER . 'pdfjs/web/compatibility.js');
echo $this->Html->script(JS_LIB_FOLDER . 'pdfjs/web/l10n.js');
echo $this->Html->script(JS_LIB_FOLDER . 'pdfjs/build/pdf.js');
echo $this->Html->script(JS_LIB_FOLDER . 'pdfjs/web/debugger.js');
echo $this->Html->script(JS_LIB_FOLDER . 'pdfjs/web/viewer.js');
?>
<script type="text/javascript">
'use strict';
PDFJS.imageResourcesPath = site_url+'js/library/pdfjs/web/images/';
PDFJS.workerSrc = site_url+'js/library/pdfjs/build/pdf.worker.js';
PDFJS.cMapUrl = site_url+'js/library/pdfjs/web/cmaps/';
</script>
I have googled this issue extensively, but found nothing on how to successfully integrate this library. Any penny help will be appreciated.
P.S. There is no error in javascript console.