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

Notification

Icon
Error

Options
Go to last post Go to first unread
Guest  
#1 Posted : Saturday, June 25, 2016 12:28:16 AM(UTC)
Guest

Rank: Guest

Groups: Guests
Joined: 1/5/2016(UTC)
Posts: 162

Was thanked: 5 time(s) in 5 post(s)
Hello,

i want to use 2 pdfviewer controls on the same winforms form.
Both controls should show the same PDF.
One control for showing PDF pages as thumbnails. The other one for showing the pages
in normal size.

So i used this code to load the PDF once and set it to both viewers.

MainPDFDoc = PdfDocument.Load("e:\test.pdf")

PdfViewer1.ViewMode = Patagames.Pdf.Net.Controls.WinForms.ViewModes.TilesVertical

PdfViewer1.AllowSetDocument = True
PdfViewer2.AllowSetDocument = True

PdfViewer1.Document = MainPDFDoc
PdfViewer2.Document = MainPDFDoc

Now when i use one viewer and scroll the pages it shows the loading text but the pages are not rendered.
It seems that there is a synchronization problem because the source PDF is bound to both viewers.
And so maybe 2 threads need to access the pdf source at the same time.



Paul Rayman  
#2 Posted : Tuesday, June 28, 2016 6:07:24 AM(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)
Hi,

Setting the document through the property is not the recommended way. That is why this feature is disabled by default.
PdfViever takes over management of pages and dispose them if they are not currently displayed to the user and loads them once they are in a visible area.
If there are two PdfViewer controls the situation above leads to conflict when the page in the first control is outside of visible area and the same page in the second control is inside.
The recommended way to load the document in this case, is use two different copies of the document.

But, you can try to change the rendering mode for PdfViewer. Try to disable the progressive rendering (UseProgressiveRender = False) for both controls. In this case, the page will be rendered atomically. It may help.
Users browsing this topic
Guest
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.