ExportAsImage Null Exception
I'm obviously doing something wrong here. The follow code has no issue getting an image from the GetPage() method but the ExportAsImage() method always throws a null exception:
public async Task ImportFileAsync(string path)
{
var file = await StorageFile.GetFileFromPathAsync(path);
if (file.FileType == ".pdf")
{
var stream = await file.OpenAsync(FileAccessMode.Read);
var fileStream = stream.AsStreamForRead();
var pdfViewer = new SfPdfViewerControl();
pdfViewer.LoadDocument(fileStream);
var image = pdfViewer.GetPage(0);
var imageStream = await pdfViewer.ExportAsImage(0) as MemoryStream;
}
}
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Syncfusion.SfPdfViewer.UWP
StackTrace:
at Syncfusion.Windows.PdfViewer.PdfDocumentView.<ExportAsImage>d__348.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Syncfusion.Windows.PdfViewer.SfPdfViewerControl.<ExportAsImage>d__604.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
What am I doing wrong?
Thanks
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
AV
Ashokkumar Viswanathan
Syncfusion Team
August 27, 2020 09:31 AM UTC
Hi Scott,
Thank you for contacting Syncfusion support,
We were able to reproduce the issue, “Application crashes with null reference exception while exporting PDF pages as images”. Currently, we are validating the issue and we will update the further details on August 31st 2020.
Regards,
Ashok Kumar Viswanathan.
AV
Ashokkumar Viswanathan
Syncfusion Team
August 31, 2020 05:15 PM UTC
Hi Scott,
We have confirmed that the issue, “Application crashes with null reference exception while exporting PDF pages as images” is a defect and logged a defect report for this issue. The patch for this issue will be delivered on September 21st , 2020.
Please find the feedback link in the below link,
Regards,
Ashok Kumar Viswanathan.
AG
Aribalakrishnan Govindasamy
Syncfusion Team
September 21, 2020 04:16 PM UTC
Hi Scott,
The issue with “Application crashes with null reference exception while exporting PDF pages as images” has been fixed and the custom NuGet for the same can be downloaded from the following link
Custom NuGet:
Disclaimer:
Please note that we have created this NuGet for version 18.2.0.56 specifically to resolve the following issue(s) reported in this forum 157313.
Note: Kindly follow the steps to clear the NuGet cache and then install patched NuGet to get the issue resolved.
This fix will be included in our 2020 Volume 3 Sp1 Release which will be available in September 2020.
Regards,
Aribalakrishnan G.
Marked as answer
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
- Marked answer
-
SK Scott Kuhl
- Aug 26, 2020 07:41 PM UTC
- Sep 21, 2020 04:16 PM UTC