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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export as image issues.

Thread ID:

Created:

Updated:

Platform:

Replies:

147874 Sep 26,2019 01:04 PM UTC Oct 5,2019 04:43 AM UTC Xamarin.Forms 5
loading
Tags: PdfViewer
Eddy
Asked On September 26, 2019 01:04 PM UTC

I need to process many PDFs and export it as an image, the first PDF works fine, however and other PDF I load and export, the image is always of the first one. I do not get any errors. This is the code I'm using:

            SfPdfViewer pdfViewerControl = new SfPdfViewer();
      
            Stream stream2 = pdfViewerControl.ExportAsImage(0,2.0f);

            stream2.Position = 0;

            byte[] imageAsBytes = Converters.ToByteArray(stream2);

            PDFImage.Source = ImageSource.FromStream(() => new MemoryStream(imageAsBytes));

            filePath = Path.Combine(localFolder, "test.png");

            File.WriteAllBytes(filePath, imageAsBytes);

Again this works fine on the first PDF, but on any other PDF all I get is an image of the first PDF.

If I add this line:

     pdfViewerControl.Unload();

I get this error:

"Object reference not set to an instance of an object."

I also tried, instead of creating the PDFViewer in code, creating it in XAML, the UnLoad works, however in this scenario, the image doesn't get exported, it just creates a 0 byte file.

     


Gayathri Ramalingam [Syncfusion]
Replied On September 27, 2019 11:38 AM UTC

Hi Eddy, 

We were able to reproduce the issues “ExportAsImage returns previous PDF page even after loading a new PDF when SfPdfViewer is instantiated in code and not added to UI" and “Null reference exception occurs while unloading the PDF Viewer” in our side and confirmed it is a defect. This fix will be included in our 2019 Vol 3 Main release which will be available in October 2019. 

With Regards, 
Gayathri R 


Eddy
Replied On September 27, 2019 03:48 PM UTC

Great, glad it's a defect and I'm not loosing my mind then. I thought I was doing something wrong.

Gayathri Ramalingam [Syncfusion]
Replied On September 30, 2019 05:38 AM UTC

Hi Eddy, 
 
Thank you for your update. 
 
As we mentioned earlier, the fix for the issues “ExportAsImage returns previous PDF page even after loading a new PDF when SfPdfViewer is instantiated in code and not added to UI" and “Null reference exception occurs while unloading the PDF Viewer will be included in our Essential Studio 2019 Volume 3 Main release which will be expected to rolled out  on 03rd October 2019. We will inform you once the release is rolled out.  
 
With Regards, 
Gayathri R 
.   



Eddy
Replied On October 3, 2019 08:23 PM UTC

I updated to the current release and that seems to have resolved my current issues. Thanks for the quick turn around on the fix.

Jhansi Priya Ramesh [Syncfusion]
Replied On October 5, 2019 04:43 AM UTC

Hi Eddy, 
 
Thank you for your update. Please get in touch with us if you would require any further assistance. 
 
Regards, 
Jhansi Priya R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon