PdfViewer loads PDF but does not display

Posted by: paineb on 30 December 2019, 3:58 pm EST

  • Posted 30 December 2019, 3:58 pm EST

    Hello,

    I want to purchase docuemtns-pdf for a client ASPA however we are having issues getting the pdf view to display a pdf on an html page. The viewer loads (can see the pages etc.) however there is no content.. just a light grey area yet all the viewer buttons render and appear to work. We pulled the code straight from your demo. Its being loaded in an html page as follows:


    <!DOCTYPE html>
    <html>
    <head runat="server">
    <meta charset="utf-8">
    <meta name="theme-color" content="#000000">
    <title>GC Viewer Demo | PDF Plugin</title>
    <script type="text/javascript" src="gcpdfviewer.js"></script>
    <link href="viewer.css" rel="stylesheet" />
    <script>
    function loadPdfViewer(selector) {
    var viewer = new GcPdfViewer(selector, { /* Specify options here */ });
    viewer.addDefaultPanels();
    viewer.open("MyPdf.pdf");
    }
    </script>
    </head>
    <body onload="loadPdfViewer('#root')">
    <form id="form1" runat="server">
    <div id="root"></div>
    </form>
    </body>
    </html>
  • Replied 1 January 2020, 5:47 am EST

  • Marked as Answer

    Replied 2 January 2020, 12:41 am EST

    Hi,
    The issue is because the PDFViewer host element's height and width is not defined which causes the issue. Once the Width or height is defined, the content will be available.
    Please refer to the following code snippet for reference:
      <form id="form1" runat="server" >
    <div >
    <div id="root" style="height:98vh;width:1920px;"></div>
    </div>
    </form>


    Hope it helps!

    Regards,
    Manish Gupta
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels