Bootstrap modal - Add a object tag embedding a PDF

后端 未结 3 491
执念已碎
执念已碎 2020-12-09 13:37

I\'m currently trying to display a bootstrap modal in which I want to include a PDF file with the \"object\" html tag. Problem is that nothing seems to display.

I\'v

相关标签:
3条回答
  • 2020-12-09 13:53

    I have found that bootstrap include a css property that affect to pdf viewing in a modal window.

    Change this:

    .modal.in .modal-dialog {
      transform: translate(0px, 0px);
    }
    

    to:

    .modal.in .modal-dialog {
      transform: none;
    }
    

    If this property is changed everything works properly.

    You can see in action:

    http://jsfiddle.net/mV6jJ/20/

    0 讨论(0)
  • 2020-12-09 14:11

    Prevent download manager: Again, if you have Internet Download Manager or any other download manager that catches pdf automatically try to prevent it from auto catch pdf link.

    Also checkout PDFObject JS, it should be interesting

    <script src="https://github.com/pipwerks/PDFObject/blob/master/pdfobject.min.js"></script>
    

    EDIT

    Please try iframe instead object type pdf

    <iframe src="http://www.inkwelleditorial.com/pdfSample.pdf" width="500" height="500"></iframe>
    

    http://jsfiddle.net/mV6jJ/9/

    0 讨论(0)
  • 2020-12-09 14:18

    Finally found the solution :) It was my browser pdf reader that wasn't configured well. Firefox was using the Adobe Reader for displaying pdf. I replaced that by pdf.js (the pdf reader of Firefox) and now everything seems to work well :) Thank you very much for your time and help :)

    0 讨论(0)
提交回复
热议问题