logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
dspector  
#1 Posted : Thursday, May 25, 2017 2:47:50 PM(UTC)
dspector

Rank: Newbie

Groups: Registered
Joined: 2/21/2017(UTC)
Posts: 5
United States

We have a window with two viewers in it, one for thumbnails and the other for larger pages. Each of these viewers has its own instance of the document.

Every now and then, when the window is instantiated and the viewers provided with documents, if you resize the window before doing anything else and then scroll through the pages in the "large page" viewer, all of the pages except those that appeared prior to scrolling are empty. It is worth noting that the proper number of pages appear, but they have no content. It is also worth noting that pages are either fully rendered or not rendered at all. Once rendering stops, all subsequent pages are blank. Sometimes when this happens, only the "large page" viewer has the problem and sometimes pages in both viewers have the problem. When both viewers have the problem, the "small page" viewer may have 5 properly rendered pages followed by 4 blank pages and the "large page" viewer may have 1 properly rendered page followed by 8 blank pages. Once pages appear as empty, they stay that way until the window is closed and re-instantiated.

I have tried setting "progressive rendering" to false, but it did not seem to make a difference. I have also tried not setting the FPDF_NO_CATCH RenderFlags, but this also did not help.

This problem is very difficult to recreate and I am not sure exactly what actions cause it. Do you have any thoughts on what could cause this behavior? If not, do you have any suggestions of what I can try to help isolate the problem? Screenshot.PNG (45kb) downloaded 20 time(s).

Edited by user Thursday, May 25, 2017 3:25:30 PM(UTC)  | Reason: Add attachment

Paul Rayman  
#2 Posted : Sunday, May 28, 2017 4:25:41 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Originally Posted by: dspector Go to Quoted Post
Each of these viewers has its own instance of the document.


Are you absolutely sure of this?
Please check it again.
The behavior you describe is typical of a situation where the same instance of PdfDocument is used by more than one viewer.

Also please check that you don't call page.Dispose() somethere.

Besides, make sure that you are using the latest version of the library.
Currently it is 3.7.7.2704

Edited by user Sunday, May 28, 2017 4:36:50 PM(UTC)  | Reason: Not specified

dspector  
#3 Posted : Monday, May 29, 2017 1:55:18 PM(UTC)
dspector

Rank: Newbie

Groups: Registered
Joined: 2/21/2017(UTC)
Posts: 5
United States

Hi Paul,

Each viewer is using its own document and we are not calling page.Dispose(). When I first started diagnosing this issue, we were on version 3.7.5. I have upgraded to 3.7.7. and still see the same issue.

A few additional notes:

1) We have seen the problem when we have one window containing two viewers, one showing thumbnails of a document and the other showing large pages of the same document. To make the situation a little easier to reproduce, for testing purposes, we have added about 4 other viewers to the same window.

2) We have seen the same problem when we have one window containing multiple tabs, each tab containing a single viewer. In this scenario, every odd tab displays the same document and every even tab displays a different document. To make the situation a little easier to reproduce, for testing purposes, we have added many tabs to the same window.


3) When this problem occurs, it generally only occurs the first time I open the windows mentioned above. If I close the window leaving the program open and then re-instantiate the window, all of the viewers show complete documents. If I keep doing this, the viewers always show complete documents. But if I shut down the program completely and restart it, the problem sometimes appears.

4) In all but one case, when this problem appears, the proper number of pages appear, but pages after a certain point contain no content. In the one exception, only one page appeared (with no content) even though the pdf being displayed contained two pages. I have never been able to recreate this.

On the surface, it looks as if something is disrupting page rendering. When PdfDocument.LoadDocument is called, does control return to the caller while or after pages are rendered? If while, is there a programmatic way to tell if page rendering is complete?
Paul Rayman  
#4 Posted : Monday, May 29, 2017 4:54:27 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
The problem is reproduced only when the same document is shown or with the different documents too?
Which method is used to load the document (PdfDocument.Load or PdfViewer.Load). Are you loading documents from a file, byte array or stream?
Could you please create a test application in which I could reproduce the problem on my side to debug it?

Are you using WPF or Winforms edition of PdfViewer?

PS. Please try to set PdfViewer.UseProgressiveRender property to false
dspector  
#5 Posted : Monday, May 29, 2017 6:37:36 PM(UTC)
dspector

Rank: Newbie

Groups: Registered
Joined: 2/21/2017(UTC)
Posts: 5
United States

See inline ...

The problem is reproduced only when the same document is shown or with the different documents too?

Same or different documents.


Which method is used to load the document (PdfDocument.Load or PdfViewer.Load). Are you loading documents from a file, byte array or stream?

We are using byte arrays and PdfViewer.Load.


Could you please create a test application in which I could reproduce the problem on my side to debug it?

I'll try to do this as soon as I can.


Are you using WPF or Winforms edition of PdfViewer?

Winforms


PS. Please try to set PdfViewer.UseProgressiveRender property to false

I had mentioned earlier in this thread that I did that and it made no difference.
dspector  
#6 Posted : Tuesday, May 30, 2017 2:38:56 PM(UTC)
dspector

Rank: Newbie

Groups: Registered
Joined: 2/21/2017(UTC)
Posts: 5
United States

I had been passing the document to the viewer as a byte array. If I convert it first to a stream and pass the stream instead, the problem no longer occurs. I will use this approach as a permanent workaround.

That being said, I still think you may have a problem with handling documents passed as byte arrays. My guess is that the byte array is getting passed by reference to the viewer and the viewer is not creating its own copy of the passed byte array and/or array elements. At some point in the process, the byte array defined in the caller may be getting disposed, affecting the viewer.

Given that I have a workaround that appears solid, I will not be creating a test application that shows the problem with the byte array. I have spent a lot of time on this issue and need to move on to other things.

Thanks for your help. Hopefully, the information I have provided will help you resolve this issue so others don't experience it.
Paul Rayman  
#7 Posted : Sunday, July 16, 2017 5:01:47 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Originally Posted by: dspector Go to Quoted Post
I still think you may have a problem with handling documents passed as byte arrays


Fixed.
http://forum.patagames.c...released-on-Jul-03--2017

Thanks!
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.