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

When I open pdf file I get crash

Could you help me to figure out what I do wrong.
When I open pdf file from byte array I get System.ArgumentNullException.

My code:
byte[] data = await GetPDF("sample.pdf");
var pdfLoadedDocument = new PdfLoadedDocument(data);                    
pdfViewer.LoadDocument(pdfLoadedDocument);
-------------------------------------
Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: crossTable
   at Syncfusion.Pdf.Parsing.PdfLoadedPageCollection..ctor(PdfDocumentBase document, PdfCrossTable crossTable)
   at Syncfusion.Pdf.Parsing.PdfLoadedDocument.get_Pages()
   at Syncfusion.Pdf.Parsing.PdfLoadedDocument.get_PageCount()
   at Syncfusion.Windows.PdfViewer.PdfDocumentView.set_LoadedDocument(PdfLoadedDocument value)
   at Syncfusion.Windows.PdfViewer.SfPdfViewerControl.LoadDocument(PdfLoadedDocument loadedDocument


Note: 
Syncfusion.SfPdfViewer.WinRT (version: 12.1810.0.43)
Syncfusion.Pdf.WinRT (version 12.1810.0.43)

18 Replies

VM Vadim Makutin April 17, 2014 04:12 AM UTC

this problem occurs when I open pdf file from database. if I open file from local folder it works perfect.


SM Suresh M Syncfusion Team April 21, 2014 06:29 AM UTC

Hi Vadim,

 

Thank you for using Syncfusion products.

 

We are not able to reproduce the issue “ArgumentNull exception is thrown when loading PDF stream to the viewer”. Please find the sample available in the link below with which we tried to reproduce the issue. Please modify this sample or provide us a new sample with which the issue could be reproduced, this would be more helpful for us to further investigate on this.

 

Sample: http://www.syncfusion.com/downloads/support/directtrac/123816/PDFViewerWintRT_20132129551588.zip

 

Please let us know if you need any further assistance.

 

Thanks,

Suresh 



SL Sébastien Lachance April 24, 2014 12:39 AM UTC

Hello Suresh,

I was helping my colleague this afternoon.

There is clearly a bug in the PDF Viewer. I was not able to access your sample project, because it has some protection when I click on the file. However, Vadim told me he was not able to reproduce it previously.

Anyway, our code is very simple:

var pdfLoadedDocument = new PdfLoadedDocument(data);
pdfViewer.LoadDocument(pdfLoadedDocument);

This code generates a 100% crash on our side.

I dig around the pdfViewer methods and I found the undocumented method pdfLoadedDocument.OpenAsync. I tried this method and it starts to work well.

1- Could you take a look on your source code to tell us what is the difference between passing the buffer to the constructor or the OpenAsync method please?

2- For PDF bigger than 4 MB, the performance is not good. It would be nice to display a progress ring when the PDF is loading. The problem is there is no event to tell us when the PDF is done loading. Am I wrong? Can you add an event?

Thank you
Sébastien



SM Suresh M Syncfusion Team replied to Sébastien Lachance April 28, 2014 10:43 AM UTC

Hello Suresh,

I was helping my colleague this afternoon.

There is clearly a bug in the PDF Viewer. I was not able to access your sample project, because it has some protection when I click on the file. However, Vadim told me he was not able to reproduce it previously.

Anyway, our code is very simple:

var pdfLoadedDocument = new PdfLoadedDocument(data);
pdfViewer.LoadDocument(pdfLoadedDocument);

This code generates a 100% crash on our side.

I dig around the pdfViewer methods and I found the undocumented method pdfLoadedDocument.OpenAsync. I tried this method and it starts to work well.

1- Could you take a look on your source code to tell us what is the difference between passing the buffer to the constructor or the OpenAsync method please?

2- For PDF bigger than 4 MB, the performance is not good. It would be nice to display a progress ring when the PDF is loading. The problem is there is no event to tell us when the PDF is done loading. Am I wrong? Can you add an event?

Thank you
Sébastien


Hi Sébastien,

 

Thank you for your interest in Syncfusion products.

 

We are not able to reproduce the issue mentioned in the incident. Please find the sample available in the link below with which we tried to reproduce the issue. Please modify this sample or provide us a new sample with which this issue could be reproduced. This will help us to further investigate on thi.

 

Sample: http://www.syncfusion.com/downloads/support/directtrac/124249/PDFViewerWintRT_2013-567023171.zip

 

Please let us know if you need any further assistance.

 

Thanks,

Suresh



SL Sébastien Lachance April 28, 2014 01:16 PM UTC

Hello,

I asked 2 questions and you replied something unrevelant.

Could you please answers my two questions?

Thank you
Sebastien



SM Suresh M Syncfusion Team April 29, 2014 05:02 AM UTC

Hi Sébastien,

 

We apologize for the inconvenience.

 

1- Could you take a look on your source code to tell us what is the difference between passing the buffer to the constructor or the OpenAsync method please?

Passing the buffer to the constructor and the OpenAsync method does the same process, whereas OpenAsync is asynchronous which helps the UI to be responsive. The documentation of loading a PDF document is available in the link http://help.syncfusion.com/UG/winrt/default.htm#!Documents/loaddocument.htm

 

2- For PDF bigger than 4 MB, the performance is not good. It would be nice to display a progress ring when the PDF is loading. The problem is there is no event to tell us when the PDF is done loading. Am I wrong? Can you add an event?

For displaying larger PDF documents in the PDF viewer, we initially display a blurred image of the page of the PDF document, then followed by displaying the actual page. We have logged a feature request report for adding an event to get the status of the page render process. Please follow up the implementation of the feature with the Direct Trac incident http://www.syncfusion.com/support/directtrac/incidents/124313

 

 

Regarding the issue mentioned “Loading the buffer into PDF document and loading it into Viewer crashes”, we are not able to reproduce the issue mentioned in the incident. Please find the sample available in the link below with which we tried to reproduce the issue. Please modify this sample or provide us a new sample with which this issue could be reproduced. This will help us to further investigate on this.

 

Sample: http://www.syncfusion.com/downloads/support/directtrac/124249/PDFViewerWintRT_2013-567023171.zip

 

Please let us know if you need any further assistance.

 

Thanks,

Suresh



SL Sébastien Lachance April 30, 2014 01:26 PM UTC

Hi,

In a little sample, I'm not able to reproduce the crash. The story must be different in a real world application.

It is a 100% crash repro when I'm using the constructor.

I would be able to help if I get the .pdb or the Syncfusion code to show you exactly where it crash. We already provided a release output.

Could it be possible to get the pdb or code? I'm also available to a remote session using Team Viewer if you want to see the crash in real-time.

Thank You
Sébastien



SM Suresh M Syncfusion Team replied to Sébastien Lachance May 7, 2014 08:48 AM UTC

Hi,

In a little sample, I'm not able to reproduce the crash. The story must be different in a real world application.

It is a 100% crash repro when I'm using the constructor.

I would be able to help if I get the .pdb or the Syncfusion code to show you exactly where it crash. We already provided a release output.

Could it be possible to get the pdb or code? I'm also available to a remote session using Team Viewer if you want to see the crash in real-time.

Thank You
Sébastien


Hi Sébastien ,

 

Thank you for your response,

 

We provide the source code only to our customers who has the source code license. Please follow up with the Direct Trac incident #124313, for organizing a web meeting to illustrate this issue.

 

Please let us know if you need any further assistance.

 

Thanks,

Suresh



DO Dib Oglesby July 31, 2015 06:13 PM UTC

To add on to this thread:

I am getting this error as well.  I can created a tab page (Visual Basic), added a PDFViewer control, and loaded up a PDF file.  If I then 1. Click the + button to zoom, 2) Click the down arrow in the bottom right to scroll, and then 3) remove the tab, which includes code to a) close the PDF file, b) call .Dispose on the PDFViewer, and c) clear out the tab's controls, I then get the error when the main screen attempts to redraw.  Here is some of the exception info:

System.ArgumentNullException: {"Value cannot be null.\rParameter name: crossTable"}
Data: System.Collections.ListDictionaryInternal
InnerException: Null
Source: Syncfusion.PDF.Base
Stack Trace:    at Syncfusion.Pdf.Parsing.PdfLoadedPageCollection..ctor(PdfDocumentBase document, PdfCrossTable crossTable)
   at Syncfusion.Pdf.Parsing.PdfLoadedDocument.get_Pages()
   at Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView.UpdateByScroll()
   at Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView.timer_Tick(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at Hurrevac2010.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

Hope this helps.  If there is an update that fixes this, that would be good to know.



DG Deepak Gunasekaran Syncfusion Team August 3, 2015 11:48 AM UTC

Hi Dib,

After investigating the stack trace provided in your post, we could see that this issue is in PDF Viewer Windows Forms.

We were able to reproduce the problem in Windows forms and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates
https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,
Deepak G


JG Julia Gonzalez December 23, 2016 10:03 PM UTC

Was this resolved? I am experiancing the same issue.


NK Navaneetha Kannan Sudalai Muthu Syncfusion Team December 27, 2016 10:03 AM UTC

Hi Vadim, 
The previously reported issue “System.ArgumentNullException is thrown while disposing the PdfViewer after scrolling” in Windows Forms had been fixed and the fix is included in our latest product version.  
Can you please confirm whether the issue on your side occurs in Windows Forms or WinRT? Also, kindly provide us with a sample illustrating the issue or steps to reproduce the issue so that we can proceed further.  
Best, 
Navaneetha Kannan 



JK Jonathan Khoo July 14, 2017 05:06 AM UTC

hi! just wanted to say i'm experiencing this error with the latest UWP version. i can get it to work if i use await + the async as described above, but that seems to be causing other problems that i'll try and work through, but it seems like this error is still present.update: it only seems to happen when i do pdfViewer.LoadDocument(fileStream) where fileStream is a well, file.OpenAsync stream. if i load the document into a byte array first, create a PdfLoadedDocument with that byte array, and then load the PdfLoadedDocument into the viewer, it works fine. *thumbs up*


AK Ayswarya Krishna Kumar Syncfusion Team July 17, 2017 04:22 PM UTC

Hi Customer,
Thank you for your update.
 
1)     if i load the document into a byte array first, create a PdfLoadedDocument with that byte array, and then load the PdfLoadedDocument into the viewer 
We are glad to know that your requirement “Loading the PDF document stream into byte[] and then load the PdfLoadedDocument into the viewer” has been achieved using PDF viewer control 
2)     i can get it to work if i use await + the async as described above, but that seems to be causing other problems that i'll try and work through, but it seems like this error is still present.update: it only seems to happen when i do pdfViewer.LoadDocument(fileStream) where fileStream is a well, file.OpenAsync stream 
We are not able to reproduce the issue, “Exception is thrown when loading PDF stream to the viewer”. We have attached the sample that we tried to reproduce the issue at our end. Please find the sample from the below link. Kindly modify the attached sample or provide us a new sample with which the issue could be reproduced. It would be more helpful for us to investigate further on your requirement and provide you better solution.

Sample link: http://www.syncfusion.com/downloads/support/forum/116169/ze/PdfViewerDemo168850455.zip
 

Regards,
Ayswarya




VW Victor Wilcox October 7, 2019 03:20 AM UTC

I am getting this behavior in version 17.3.014 in iOS.

After a user selects an item in a SfComboBox, I am querying a pdf stream from the assembly resources and using LoadDocument.  I get the exception:
**System.ArgumentNullException:** 'Value cannot be null.
Parameter name: view'

I have tried loading the stream into a buffer and putting it into a managed stream with no change.  I have used a timer to delay the load with no effect.  Using Device.BeginInvokeOnMainThread or not using it makes no difference.

I have the load inside of a try / catch, but somehow the exception evades my wrapper and the entire application hard crashes after the:
**System.ArgumentNullException:** 'Value cannot be null.
Parameter name: view'

The original code:

              Stream stream;

              stream = (GetType()).Assembly.GetManifestResourceStream("TheResourceName");
              this.pdfFloorView.LoadDocument(stream);


In my startup code, I do have this:

      Syncfusion.SfPdfViewer.XForms.iOS.SfPdfDocumentViewRenderer.Init();
      Syncfusion.SfRangeSlider.XForms.iOS.SfRangeSliderRenderer.Init();



I then tried using Binding instead of LoadDocument.  I still get the error, but now I got a long dump instead of it just cutting off instantly:

[0:] System.ArgumentNullException: Value cannot be null.
Parameter name: view
  at UIKit.UIView.AddSubview (UIKit.UIView view) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIView.g.cs:268 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.RemoveIndicator () [0x00025] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.ScrollToHorizontalOffset (System.Double horizontalOffset) [0x00008] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at Syncfusion.SfPdfViewer.XForms.iOS.PdfViewerDependencyService.ScrollToHorizontalOffset (System.Single horizontalOffset, System.Object nativeObject) [0x00008] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at Syncfusion.SfPdfViewer.XForms.SfPdfViewer.set_HorizontalOffset (System.Single value) [0x00026] in :0 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.ScrollViewEx_Scrolled (System.Object sender, System.EventArgs e) [0x0040e] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at UIKit.UIScrollView+_UIScrollViewDelegate.Scrolled (UIKit.UIScrollView scrollView) [0x0000a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIScrollView.g.cs:1632 
--- End of stack trace from previous location where exception was thrown ---

  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_CGPoint(intptr,intptr,CoreGraphics.CGPoint)
  at UIKit.UIScrollView.set_ContentOffset (CoreGraphics.CGPoint value) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIScrollView.g.cs:597 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.set_ContentOffset (CoreGraphics.CGPoint value) [0x00000] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_CGRect(intptr,intptr,CoreGraphics.CGRect)
  at UIKit.UIView.set_Frame (CoreGraphics.CGRect value) [0x00024] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIView.g.cs:3684 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.LayoutSubviews () [0x000ad] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at OpComm.iOS.Application.Main (System.String[] args) [0x00001] in C:\src\opcomm\Presentation\Mobile\OpComm.iOS\Main.cs:17 
2019-10-06 22:15:39.032365-0500 OpComm.iOS[77072:3462828] Unhandled managed exception: Value cannot be null.
Parameter name: view (System.ArgumentNullException)
  at UIKit.UIView.AddSubview (UIKit.UIView view) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIView.g.cs:268 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.RemoveIndicator () [0x00025] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.ScrollToHorizontalOffset (System.Double horizontalOffset) [0x00008] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at Syncfusion.SfPdfViewer.XForms.iOS.PdfViewerDependencyService.ScrollToHorizontalOffset (System.Single horizontalOffset, System.Object nativeObject) [0x00008] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at Syncfusion.SfPdfViewer.XForms.SfPdfViewer.set_HorizontalOffset (System.Single value) [0x00026] in :0 
  at Syncfusion.SfPdfViewer.XForms.iOS.ScrollViewEx.ScrollViewEx_Scrolled (Syste
m.Object sender, System.EventArgs e) [0x0040e] in <14428b97638f4b78bf87327ed9c8deaa>:0 
  at UIKit.UIScrollView+_UIScrollViewDelegate.Scrolled (UIKit.UIScrollView scrollView) [0x0000a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.2.0.42/src/Xamarin.iOS/UIScrollView.g.cs:1632 
--- End of stack trace from previous location where exception was thrown ---

... ommitted some due to length ...

=================================================================
Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7fff513782c6
):0x7fff513782b6  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....
0x7fff513782c6  73 08 48 89 c7 e9 87 a1 ff ff c3 55 48 89 e5 41  s.H........UH..A
0x7fff513782d6  57 41 56 41 55 41 54 53 48 81 ec 88 00 00 00 4d  WAVAUATSH......M
0x7fff513782e6  89 cf 49 89 f4 48 8d 05 96 7e 81 38 48 8b 00 48  ..I..H...~.8H..H

=================================================================
Managed Stacktrace:
=================================================================
=================================================================

In Xamarin.iOS version I noticed there is an opportunity to set the subview, but I am using Xamarin Forms so not sure if I can make that happen or not.


JP Jhansi Priya Ramesh Syncfusion Team October 7, 2019 01:01 PM UTC

 Hi Victor, 
 
We are currently checking on this issue. We will update you shortly. 
 
Regards, 
Jhansi  



JP Jhansi Priya Ramesh Syncfusion Team October 7, 2019 06:07 PM UTC

Hi Victor, 
 
Sorry for the inconvenience caused. 
 
We are still working to reproduce the issue on our side. We will update further details on 8th October 2019. 
 
Regards, 
Jhansi Priya Ramesh   



JP Jhansi Priya Ramesh Syncfusion Team October 8, 2019 01:21 PM UTC

Hi Victor, 
 
We tried reproducing the issue of “Exception occurred while loading PDF document” in Xamarin Forms iOS, but it is working fine as expected. Please find the sample in the below link for your reference.  
  
  
Kindly share the following details to analyze more on this issue and assist you with the better solution   
1.       Simple sample/ modify the above sample to reproduce the issue.  
2.       Xamarin.Forms version  
3.       Replication procedure to reproduce the issue.  
4.       Device specification in which the issue could be reproduced. 
 
 
Regards, 
Jhansi Priya Ramesh 


Loader.
Live Chat Icon For mobile
Up arrow icon