I have an external pdf that I'd like to show embedded in my page. The following works fine:
<object frame-resize data="www.cbu.edu.zm/downloads/pdf-sample.pdf" type="application/pdf" width="200px" height="200px"></object>
Problem: I want to show this embedded pdf in a modal
window. But as soon as I move it there, the pdf is not displayed correctly anymore:
<a data-toggle="modal" data-target=".my-modal"></div>
<div class="modal fade my-modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<object frame-resize data="www.cbu.edu.zm/downloads/pdf-sample.pdf" type="application/pdf" width="200px" height="200px"></object>
</div>
</div>
</div>
</div>
Result: I'm getting the following error:
offsetParent is not set -- cannot scroll viewer.js:150:5
scrollIntoView() viewer.js:150
PDFViewer_scrollPageIntoView() viewer.js:4880
pagechange() viewer.js:7394
PDFViewer.prototype.currentPageNumber() viewer.js:4558
pdfViewSetInitialView() viewer.js:6697
resolved()
PDF 0bf9e083c3a94f2cd2e1740080c8c88c [1.4 Acrobat Distiller 7.0.5 (Windows) / Adobe Acrobat 7.0] (PDF.js: 1.1.215)
TypeError: canvas._viewport is undefined
NotFoundError: Node was not found
How can I though embed this into a modal dialog?
Interestingly, when I close the modal dialog and open it again, the pdf is rendered correctly!
Update:
Solution: I had css
tag as follows:
html {
overflow-y: scroll;
}
This is to prevent content shifting when the webpage exceeds the visible content height.
Question: does anybody know how I can keep this tag, and ignore it just for the modal window?
I have a solution but its taking too much time. Here is my solution. //------------ Image url to base64 -------------// function convertImgToBase64(url, callback, outputFormat){ var img =...
I have a solution but its taking too much time. Here is my solution. //------------ Image url to base64 -------------// function convertImgToBase64(url, callback, outputFormat){ var img =...
I was trying to get the background color of an element using javascript: URL: https://mathemagiker.de/ Javascript: document.getElementById('angebot').style.backgroundColor Result: Nothing However ...
I was trying to get the background color of an element using javascript: URL: https://mathemagiker.de/ Javascript: document.getElementById('angebot').style.backgroundColor Result: Nothing However ...
How I can use selectize.js with remote source? I have followed this example: $('#select-repo').selectize({ valueField: 'url', labelField: 'name', searchField: 'name', create: false, ...
How I can use selectize.js with remote source? I have followed this example: $('#select-repo').selectize({ valueField: 'url', labelField: 'name', searchField: 'name', create: false, ...
i'm trying to inline edit an input this way, i wrote a clickOutside directive and it works fine but in my example when i click to edit editMode becomes true and immediately input is shown and ...
i'm trying to inline edit an input this way, i wrote a clickOutside directive and it works fine but in my example when i click to edit editMode becomes true and immediately input is shown and ...