1

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?

Bert1992
  • 73
  • 1
  • 10
  • 2
    I don't think this anything to do with pdf.js -- pages are not rendering since pdfViewer height is 0px. Probably http://stackoverflow.com/questions/10871898/why-cant-i-make-my-div-100-height-if-i-use-an-html5-doctype-how-do-i-get-it-1 will help – async5 Aug 18 '14 at 15:23
  • YES, that's it. Thanks for your reply. I've set a height to the parent node. – Bert1992 Aug 18 '14 at 15:33
  • If you want the reputation points, post your answer. Thanks again. – Bert1992 Aug 18 '14 at 15:45
  • Your site links are prompting for a login for me... and links without code are not good formats for Stack Exchange sites anyway, because of [link rot](https://en.wikipedia.org/wiki/Link_rot). Please post your relevant code in your question. – ajp15243 Aug 18 '14 at 15:50

1 Answers1

1

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;}
Community
  • 1
  • 1
Bert1992
  • 73
  • 1
  • 10