简体   繁体   中英

pdf.js not working with <!DOCTYPE HTML>

I'm using PDF.js to preview a PDF doc in my page.

I't works perfectly without doctype on top of the page. But when I add it, the PDF viewer stops working.

My doctype:

<!DOCTYPE HTML>

Where I call the viewer:

echo '<div id="pdfViewer">';
    include('pdf_viewer.php');
echo '</div>';

CSS style of the pdfViewer division:

#pdfViewer {
   margin: 10px;
}

How can I add the doctype declaration and still keep my viewer working?

The problem was indeed that the parent didn't have a height.

see: Why can't I make my div 100% height if I use an HTML5 doctype? How do I get it 100% height

example:

#pdfViewer {height: 800px;}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM