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

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, June 18, 2015 12:31:22 AM(UTC)
sparcopt

Groups: Registered
Posts: 13


Thank you!

By the way, I tried the WinForms DocumentViewer in WPF and the scroll is not as smooth as in WPF with my own implementation.

Do you know what is causing this?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, June 18, 2015 5:14:06 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Our moderator split this post into a new thread because it's not a direct continuation of the original issue you raised in the original thread.
If you suspect our control is having issues related to smooth scrolling, as compared to a different control you have on the same form, please create a simple project that shows this issue and email it to support@leadtools.com to open a support ticket for it.
If you send a project, make sure to put all files in a ZIP or RAR file.

Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Thursday, June 18, 2015 7:47:28 AM(UTC)
sparcopt

Groups: Registered
Posts: 13


Hi Maen,

You can use the example from this folder:
C:\LEADTOOLS 19\Bin\Dotnet4\Win32\CSDocumentViewerDemo_Original.exe

And you can compare it against this WPF project that JustinF shared here on the forums:
http://support.leadtools.com/SupportPortal/CS/forums/44690/PostAttachment.aspx

You will notice the scroll on the WinForms project, using DocumentViewer, is not as smooth as the WPF project, using RasterImageViewer control.
 
#4 Posted : Monday, June 22, 2015 2:26:34 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

You are comparing different things that should not be compared this way.

The WPF project from Justin loads the PDF file as raster images. After the initial delay for loading the images and converting them to bitmaps in memory (rasterizing), no more processing is needed on the images.
However, the document viewer demo contains more sophisticated processes than just viewing the images. It contains dynamic objects parsing, text selection and extraction, etc. It's expected for all of these features to affect the scrolling speed to be slightly slower than regular imaging scrolling.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Monday, June 22, 2015 2:48:40 AM(UTC)
sparcopt

Groups: Registered
Posts: 13


Thank you Maen, it makes sense.

So, there is a way to disable all or at least some the extra features of document viewer to make the scroll faster? For the moment I only want to load the PDF pages and nothing more. I noticed that I can turn off annotations, there is something more that I can disable?

My best regards.
 
#6 Posted : Monday, June 22, 2015 3:51:40 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

The following code (from our documentation) shows how you can create a small C# Document Viewer application to view PDF documents:
+------------------------------+
private void Form1_Load(object sender, EventArgs e)
{
// Create the UI of the application. Two panels, one
// for the thumbnails (on the left) and one for the view (fill the form)
var viewPanel = new Panel { Dock = DockStyle.Fill };
this.Controls.Add(viewPanel);
var thumbnailsPanel = new Panel { Dock = DockStyle.Left };
this.Controls.Add(thumbnailsPanel);

// Create the document viewer using the panels we created
var createOptions = new DocumentViewerCreateOptions { ViewContainer = viewPanel, ThumbnailsContainer = thumbnailsPanel };
var documentViewer = DocumentViewerFactory.CreateDocumentViewer(createOptions);

// Set some options, such as Pan/Zoom interactive mode
documentViewer.Commands.Run(DocumentViewerCommands.InteractivePanZoom);
// And view the documents as SVG if available - no rasterization
documentViewer.View.PreferredItemType = DocumentViewerItemType.Svg;

// Load a PDF document
var document = DocumentFactory.LoadFromFile(@"c:\Temp\1000pages.pdf", new LoadDocumentOptions { UseCache = false });
// Set in the viewer
documentViewer.SetDocument(document);

//base.OnLoad(e);
}
+------------------------------+

I checked the above code on my side and the scrolling was smooth and fast.
You can find more information in the following online help topic:
https://www.leadtools.com/help/leadtools/v19/dh/to/leadtools.topics.documents.ui~doxui.topics.documentviewer_using.html

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#7 Posted : Monday, June 22, 2015 5:01:49 AM(UTC)
sparcopt

Groups: Registered
Posts: 13


Yes, I'm using the same code as you.

+--------------------------------------+
// Create the interop host control.
System.Windows.Forms.Integration.WindowsFormsHost host =
new System.Windows.Forms.Integration.WindowsFormsHost();

// Create the UI of the application
var viewPanel = new System.Windows.Forms.Panel { Dock = DockStyle.Fill };
host.Child = viewPanel;

// Create the document viewer using the panels we created
var createOptions = new DocumentViewerCreateOptions { ViewContainer = viewPanel, UseAnnotations = false };
_documentViewer = DocumentViewerFactory.CreateDocumentViewer(createOptions);

// And view the documents as SVG if available - no rasterization
_documentViewer.View.PreferredItemType = DocumentViewerItemType.Image;

// Load a PDF document
var document = DocumentFactory.LoadFromFile(PdfPath, new LoadDocumentOptions { UseCache = false });
// Set in the viewer
_documentViewer.SetDocument(document);

// Add the interop host control to the Grid control's collection of child controls.
this.grid1.Children.Add(host);
+--------------------------------------+

The main difference is that I'm using it in WPF. The other difference is _documentViewer.View.PreferredItemType. If I leave it to Svg it doesn't load the page contents, I only get empty pages. If I set it to Image or if I don't set it, I can see the page contents but the scrolling is very slow.
Even with a 1 page PDF, the scroll is slow. I'm not understanding what's going wrong.
 
#8 Posted : Tuesday, June 23, 2015 4:21:17 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Since your application is WPF, it will be better to use one of our WPF viewers such as the RasterImageViewer control.
With that viewer, display the PDF pages as images like Justin's code does. This should solve both the empty pages and the scrolling problems you're facing. I think this approach will save time, because our own testing here did not show the same problems at our side using the Document Viewer in WinForms application.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#9 Posted : Tuesday, June 23, 2015 6:10:56 AM(UTC)
sparcopt

Groups: Registered
Posts: 13


Yes, thanks to Justin's help I was able to do everything very smoothly with RasterImageViewer in WPF. Unfortunatly, I faced the issue of extending the scrollviewer to the size of the whole PDF document. Currently, it only extends to the size of the pages in memory. Justin advised me to use a placeholder, but that's seems a quite complex implementation and that's when we ended up with WinForms DocumentViewer and here we are.

From my point of view, It seems I can't do anything more to get a faster scroll with DocumentViewer in WPF. I will try to take a shot at RasterImageViewer and implement the placeholder.

It would be useful if there was a control like DocumentViewer for WPF.

Thank you for your support Maen.
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.093 seconds.