Pdf page doesnt load and image doesnt resize

Hey guys,

When using your sample from the getting started page: 
Sample
And loading in the attached document (or any landscape pdf with image that isn't full page) the page will be white with nothing rendered and then if I click the zoom button, it will render the image but doesn't resize it to fit the whole page.

This doesn't happen on your Demo though . Is there something missing from the sample that affects how the page loads and how the image is resized (like it is on the demo)?


Attachment: Test_Landscape_PDF_f597ca4d.zip

3 Replies 1 reply marked as answer

AC ArunKumar Chandrakesan Syncfusion Team September 12, 2022 11:51 AM UTC

Hi Barney,


Kindly refer to the below sample and code snippet provided to initially load the landscape pdf document as fit to width,  and let us know if the solution provided is helpful to you


Code snippet:

HTML:

@Html.EJS().PdfViewer("pdfviewer").DocumentLoad("documentLoaded").ServiceUrl(VirtualPathUtility.ToAbsolute("~/api/PdfViewerTest/")).DocumentPath("FormDesigner.pdf").Render()

 

Javascript:

 

function documentLoaded() {

        var pdfviewer = document.getElementById('pdfviewer').ej2_instances[0];

        pdfviewer.magnificationModule.fitToPage()

 

    }


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewer_MVC_(1)1996534773.zip


Regards,

Arun kumar


Marked as answer

BH Barney Hornsby September 19, 2022 01:53 AM UTC

Hey guys,

The problem ended up being that in your MVC demo and also in a couple of your samples on the startup pages, viewPortWidth and viewPortHeight in the jsonObjects class were not named correctly and were not being set as intended because of this.

Thanks for your help, it now works correctly.



AC ArunKumar Chandrakesan Syncfusion Team September 19, 2022 01:28 PM UTC

Hi Barney,

 

 Thank you for your updates

 

Regards,

Arun kumar


Loader.
Up arrow icon