简体   繁体   English

pdf.js无法使用<!DOCTYPE HTML>

[英]pdf.js not working with <!DOCTYPE HTML>

I'm using PDF.js to preview a PDF doc in my page. 我正在使用PDF.js预览页面中的PDF文档。

I't works perfectly without doctype on top of the page. 没有页面顶部的doctype,我无法完美工作。 But when I add it, the PDF viewer stops working. 但是,当我添加它时,PDF查看器停止工作。

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部门的CSS样式:

#pdfViewer {
   margin: 10px;
}

How can I add the doctype declaration and still keep my viewer working? 如何添加doctype声明并仍保持查看器正常工作?

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? 请参见: 如果使用HTML5文档类型,为什么不能将div高度设为100%? How do I get it 100% height 如何获得100%的高度

example: 例:

#pdfViewer {height: 800px;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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