We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Issue with PdfViewer and System.Drawing.Common.dll

Hi Team,
i tried the PDF Viewer Preview and understood the working principle and implemented it as mentioned in your demo.
Unfortunately there is an error with the System.Drawing.Common.dll.
You use this reference for creating a bitmap of the selected page out of the in-memory-stored pdf-bytes[]. During creating this bitmap i encountered this error and wanted to ask you if you can reproduce that error or what may caused that thing?


I use this references... 



Please note the comments below… everything works until it goes to the point where the image-conversion starts...



7 Replies

RT Ramya Thirugnanam Syncfusion Team January 7, 2019 07:29 AM UTC

Hi Florian, 
 
Thanks for contacting Syncfusion support. 
 
We are unable to reproduce the reported issue with mentioned scenario. However, we suspect that the issue may be occurred when the value of the zoomFactor is negative in the jsonObject. We have provided the sample and JsonObject image (screenshot to pdf) to represent this. Please refer to the sample as below. 
 
 
The jsonObject must contain variables as shown in the below screenshot to render the PDF document. 
 
 
 
 
Could you please validate the provided sample with reported issue the above sample and provide us with the modified sample or video to replicate the reported issue and confirm us whether you are sending your own JSON data. if so please provide us JSON data regarding it.  
 
Regards, 
Ramya T 



FS Florian Schwendtner January 7, 2019 05:38 PM UTC

Hi Ramya,

thanks for your reply!

I brought it alive now... and yes, it was the zoomFactor.


Now another thing: if I load a pdf in the viewer and the viewer is too small to display it at a zoomValue of 100 and tries to open it with a zoomValue of around 0.60 the page is not getting displayed properly. I came across this issue with the following code but you need to help me how to reset the zoomValue programmatically until the document is loaded properly.


Ended up with this solution but there has to be a propper call to get the zoomValue back to 100 until document is properly loaded:




Yours,
Florian


RT Ramya Thirugnanam Syncfusion Team January 8, 2019 09:42 AM UTC

Hi Florian, 
 
We can reproduce the reported issue “PDF document is not displaying with lower zoom percentage” with older scripts.  But, the reported issue is resolved with the latest script files (Version: 16.4.0.44). So, could you please update the Syncfusion.EJ2.JavaScript NuGet package to the latest version to get this issue resolved by following the below steps. 
 
  1. Download the latest nuget package from the below link,
 
  1. Copy the scripts and CSS files to the wwwroot folder in the previously provided sample and link the same in _Layout.cshtml using the below code
<link rel='nofollow' href="~/css/material.css" rel="stylesheet"> 
        <script src="~/js/ej2.min.js"></script> 
 
 
The issue will be resolved with the updated script files and there is no need to use the code changes (without) which was shared in your last update.  
 
Regards, 
Ramya T 



FS Florian Schwendtner January 9, 2019 04:29 PM UTC

Hi Ramaya,

i did as you mentioned and updated everything to the latest version. 

The behaviour is: 
- by issuing the PdfViewer.Load() method the method gets called but the processing will not finish - the "loaded" event never gets triggered
- the .Load() method changes the document zoom to 0.60 (60%) due to the small size of the viewer and fires the event "documentzoomchange"
- if i manually change the .magnification.zoomfactor back to 1 - and only then - the document gets loaded successfully... 

I attached a video where you can see clearly that after the initial loading and changing the zoomlevel manually to 100% everything works fine until I zoom out and try to load the next pages of the document. the pages are only getting loaded successfully if the zoomlevel is 1/100%. after initially loading with 100% zoom out and in works well - but if the initial page load is not made with 100% the pages will not get rendered. 

I hope you can reproduce this with a large document with about 20+ pages where the couple first are maybe loaded at 100% and if you zoom out and scroll then down to the next pages they are not getting loaded successfully... until you zoom out to 100% :-)

Attachment: medinet_Client___Login__Google_Chrome_09.01.2019_17_15_20_bcb0f482.zip


RT Ramya Thirugnanam Syncfusion Team January 10, 2019 11:16 AM UTC

Hi Florian, 
 
We were unable to reproduce the issue with the provided details. We have provided sample and video to represent this. Please find the sample and video from the below link. 
 
 
 
Could you please try the provided sample and modify it to replicate the reported issue and share us the modified sample with the tried PDF document ? This will help us to investigate further on the issue. 
 
Regards, 
Ramya T 



FS Florian Schwendtner January 11, 2019 10:19 AM UTC

Hi Ramya,

thanks for your test project. If i change nothing, just download and run it, it will still show the initial error in this thread: "Parameter is not valid."

Then I add the line with the zoomFactor and the document is shown, but only at 100%. So the following error we are discussing now is just a child of the original error with the smaller than 1 values in the zoomFactor. What should I update that this System.Drawing error disappears?

If i add this line the document loads, but only at 100% (what makes sense) - if I delete the line it will not load anything with a zoomFactor smaller than 1.



The only thing that is not included in your sample is the System.Drawing.dll from the asp.net core - isn't it? Can you create a self-contained deployment and provide me the example? maybe you have a different dll in the GAC or something like this. Otherwise i have no idea whats so different from our computers.


KC Karthikeyan Chandrasekar Syncfusion Team January 17, 2019 11:50 AM UTC

Hi Florian, 
We have installed the System.Drawing.Common in the previously provided sample but we are unable to reproduce the reported issue. So we have shared the sample with the Nuget packages which we have tried to reproduce the issue in the below link,  
Kindly refer the Nuget available in ‘Packages’ folder of the provided sample manually. Please try this and revert us with the modified sample in which the issue could be reproduce and the following machine details if the issue still exists in your side .  
  • Operating System:  
  • System Bit Information:  
  • System Culture Information:  
  • Essential Studio Version:  
  • Visual Studio Version:  
  • RAM capacity:  
  • NET framework: 
  • Platform: 

These details will be helpful for us to investigate more on your requirement and assist you better.  
Regards,  
Karthikeyan 


Loader.
Live Chat Icon For mobile
Up arrow icon