|147874||Sep 26,2019 01:04 PM UTC||Oct 5,2019 04:43 AM UTC||Xamarin.Forms||5|
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");
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:
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.
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.
This page will automatically be redirected to the sign-in page in 10 seconds.