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 : Friday, March 16, 2018 3:19:54 PM(UTC)
Toadfish

Groups: Registered
Posts: 20


The setDocument method is kind of a black box to us but what it looks like is it calls out for each page of a document the getImage or getSvg method in the Document Factory in the API.

However, for documents with large numbers of pages, we are seeing these calls block a call to another API and forcing this call to wait until the getImage/Svg calls have returned

Without going into too much detail, right now we want to skip all calls to GetImage and GetSvg from from setDocument method. Is this possible? Can we trigger the getting of document data manually and NOT have setDocument do it?

Thanks for any help.
 

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 : Monday, March 19, 2018 11:41:08 AM(UTC)
Duncan Quirk

Groups: Registered, Tech Support, Administrators
Posts: 70

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

Hello,

Thank you for posting your question on the LEADTOOLS Technical Forums.

If you are wanting to skip, or block all calls to the GetImage/GetSvg methods that are fired when setDocument is called, you can hook into the operation event for the Document Viewer, and abort the request(s) there. The event that is made to get the image/svg data is GetPage. Here is our documentation for operation event: https://www.leadtools.co...entviewer-operation.html

You can also find the enumeration for all the Document Viewer operations here: https://www.leadtools.co...mentvieweroperation.html

You can find all the events that are fired when you call setDocument in our documentation here: https://www.leadtools.co...viewer-setdocument.html#!

If you wanted to go about doing it in this fashion, you would have to incorporate when a page should be rendered/displayed, and when the GetImage/GetSvg methods should be aborted.

That being said, by default, the Document Viewer will attempt to load all images when the document is ready. To increase performance for particularly large documents, you could enable lazy loading. This will force the Document Viewer to only load images when they are made visible on the screen. The lazyLoad property can be toggled on and off at any point. Here is our documentation for this property: https://www.leadtools.co...viewerview-lazyload.html

If you have any further questions or technical issues, please feel free to let me know.
Duncan Quirk
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Monday, March 19, 2018 3:03:54 PM(UTC)
Toadfish

Groups: Registered
Posts: 20


I've added the following code to my documentViewer initialization:

this.documentViewer.operation.add((sender, e) => {
if (e.operation == lt.Documents.UI.DocumentViewerOperation.getPage && !e.isPostOperation) {
e.abort = true;
}
});

I put a breakpoint on the e.abort=true and my code does make it there.
However, I still see the getImage/getSVG requests getting fired off to the API.

This seems to be what the example you sent does as well.

I'm running this is an Angular2/TypeScript application with Leadtools V19.
 
#4 Posted : Tuesday, March 20, 2018 8:47:56 AM(UTC)
Duncan Quirk

Groups: Registered, Tech Support, Administrators
Posts: 70

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

Hello,

In order to abort the getPage event, you will need to access the underlying ImageLoader object that is associated with the event. This object can be retrieved from e.data1. Once you have the ImageLoader, you can simply call the abort() method to cancel the request. If the document has back images, you can access the imageLoader that is loading the backimages through e.data2. All and all, the event method should look like this to cancel the getPage event:
Code:

_this.documentViewer.operation.add((sender, e) => {
        if (e.operation == lt.Documents.UI.DocumentViewerOperation.getPage && !e.isPostOperation) {
            var imageLoader = e.data1;
            imageLoader.abort(); //abort loading the main page data

            var backImageLoader = e.data2;
            backImageLoader.abort(); //abort loading the back page data

            console.log(imageLoader); //Check the _isAborted property in the console. 
        }
    });


This will just abort grabbing the main Image Data for the page -- this will not prevent the thumbnails from loading. You would have to add additional logic to abort loading thumbnails.

Here is our relevant documentation for the ImageLoader object:
https://www.leadtools.co...ript/l/imageloader.html#!
https://www.leadtools.co...l/imageloader-abort.html

If you have any further questions or concerns, please feel free to let me know.
Duncan Quirk
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
#5 Posted : Tuesday, March 20, 2018 8:56:17 AM(UTC)
Toadfish

Groups: Registered
Posts: 20


That did the trick! Thank you.
 
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.165 seconds.