Change height of PdfViewer dynamically

Hello.

Is there a way to set the height of the PdfViewer on 100% respectively set the height dynamically?
When I initialize the PdfViewer I have to set a fix height for the control, otherwise I only see the toolbar.
My problem is, that if I set the height e.g. to 1000 it is to big for the window and i got 2 scrollbars. But i want the PdfViewer to adjust its size dynamically to the outer window. E.g. if I resize the browser, the PdfViewer should adjust its size, so i always only got one scrollbar at the PdfViewer.

Thanks

Attachment: PdfViewer_92e2e6a5.zip

7 Replies

AA Akshaya Arivoli Syncfusion Team April 27, 2020 12:47 PM UTC

Hi Matthias ,                      

Thank you for contacting Syncfusion support. 

We can set the PDF Viewer height of the PDF Viewer to window size by providing the height to 100vh for the PDF Viewer. Please refer to the below code, 

      <div style="height:100vh"> 
        <ej:PdfViewer ID="PdfViewer1" runat="server" PdfService="Local" documentPath ="Handbuch" ServiceUrl="../api/PdfViewer" > 
        </ej:PdfViewer> 
  </div> 
                       
We can also resize the PDF Viewer based on the parent element height using the updateViewerSize() API. 

Please try it and share us the simple PDF Viewer sample and more details about your requirement if you still need any further assistance. It will be helpful for us to investigate further and assist you better. 
Regards, 
Akshaya. 



MW Matthias Wagner April 28, 2020 08:18 AM UTC

Hello Akshaya,

I tried both ways you told me. But for none of these both it works for me. If I resize the window I still get two scrollbars.
I attached an example in which I have both ways implemented. Can you please have a look if I am doing something wrong?

Thanks
Matthias

Attachment: PdfViewerHeight_45cbcb8.zip


AA Akshaya Arivoli Syncfusion Team April 30, 2020 01:42 AM UTC

Hi Matthias, 

Thank you for your update. 

We can reproduce the reported issue with the provided details, we will analyze further on it and update you with more details on May 4th, 2020.  

Regards, 
Akshaya 



AA Akshaya Arivoli Syncfusion Team May 4, 2020 03:42 PM UTC

Hi Matthias , 
  
We can able to reproduce the reported issue “On resizing the scroll bar appeared “and log it as a defect and the fix will be included in May 18 2020.However we can apply the 100% height to the PDF Viewer by providing the height 100% for all the parent elements. Please find the code-snippet below. 
  
html style="width:100%;height:100%;"> 
<head runat="server"> 
   
    <asp:ContentPlaceHolder ID="head" runat="server"> 
    </asp:ContentPlaceHolder> 
</head> 
<body style="width:100%;height:100%;margin:0px;"> 
    <form id="form1" runat="server" style="width:100%;height:100%;"> 
        <div style="width:100%;height:100%;"> 
            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> 
            </asp:ContentPlaceHolder> 
        </div> 
    </form> 
</body> 
</html> 
  
   <div style="width:100%;height:100%;min-height:500px"> 
        <ej:PdfViewer ID="PdfViewer1" runat="server" PdfService="Local" documentPath ="Handbuch" ServiceUrl="../api/PdfViewer" EnableTextSelection="false" > 
        </ej:PdfViewer> 
    </div> 
  
  
You can track the status of the bug using the below link, 
  
  
Regards, 
Akshaya. 
  



AA Akshaya Arivoli Syncfusion Team May 19, 2020 01:55 PM UTC

Hi Matthias , 
                                                               
Thank you for your patience. 

We have fixed the reported issue and provided the patch for the same in the below link, 

HTTP Link 
HTTP Link(Assemblies) 
HTTP Link(Nuget) 
 

Disclaimer :
Please note that we have created this patch for version 18.1.0.52c specifically to resolve the following issue(s) reported in this/the forum 153623

If you have received other patches for the same version for other products, please apply all patches in the order received. 

The fix will be included in our 2020 Volume 2 release which is expected to be rolled out in the end on June 2020. 

Regards, 
Akshaya 



MW Matthias Wagner June 3, 2020 07:38 AM UTC

Thanks, works now.


AA Akshaya Arivoli Syncfusion Team June 3, 2020 07:43 AM UTC

Hi Matthias , 

Thank you for your update. We are glad to know that the reported issue is resolved. 

Regards, 
Akshaya 


Loader.
Up arrow icon