Hello,
I am using web document viewer using .NET core API , I have tried drawing annotation from server side using DeserializeAnnotationCollections method but it does not draw annotation at same X,Y where I intended.
However I noticed that 3 API is called
1) Getimageinfo
2) DeserializeAnnotationCollections
3) RenderImageTile
RenderImageTile API send parameter scale as x=0.48 and y=0.48 which return image with scale 0.48 So, I re-calculate my annotation X,Y coordinate with 0.48 and it draw annotation properly where it should display
Below are some query
1) Can I call RenderImageTile API before DeserializeAnnotationCollections so that I get scale value and re-calculate annotation X,Y
2) Can I get scale value of every page on DeserializeAnnotationCollections API
3) Is their any other method where I can get scale value of every page so that I can use it in DeserializeAnnotationCollections API to re-calculate and send annotation as response
Thanks
Jwalit Katira
Get scale value during DeserializeAnnotationCollections in .net core api using web document viewer
Moderator: Alex
-
- Posts: 31
- Joined: Mon Sep 18, 2023 1:41 pm
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Get scale value during DeserializeAnnotationCollections in .net core api using web document viewer
Hello Jwalit,
You can get zoom value in image viewer using the WebImageViewerJS.get_Zoom function.
Why do you send direct requests to the DeserializeAnnotationCollections API? Please send me more info about your task.
Best regards, Alexander
You can get zoom value in image viewer using the WebImageViewerJS.get_Zoom function.
Why do you send direct requests to the DeserializeAnnotationCollections API? Please send me more info about your task.
Best regards, Alexander
-
- Posts: 31
- Joined: Mon Sep 18, 2023 1:41 pm
Re: Get scale value during DeserializeAnnotationCollections in .net core api using web document viewer
Hello Alex,
I have checked get_zoom always give 100 when page is load , Also i am not calling DeserializeAnnotationCollections API directly it is called when next page is clicked automatically , so on every next page i get annotation and display it in image as response , but in RenderImageTile call i get different scale value , below is example of my tiff page1 and page 2 , so i am not sure how much my image is scaled , so due to which my annotations are not displayed at given x and Y
Page 1 Request of RenderImageTile
Page 2 Request of RenderImageTile
Can you please let us know why the scale value is different in both page and how can i get this scale value in DeserializeAnnotationCollections API
Thanks
Jwalit Katira
I have checked get_zoom always give 100 when page is load , Also i am not calling DeserializeAnnotationCollections API directly it is called when next page is clicked automatically , so on every next page i get annotation and display it in image as response , but in RenderImageTile call i get different scale value , below is example of my tiff page1 and page 2 , so i am not sure how much my image is scaled , so due to which my annotations are not displayed at given x and Y
Page 1 Request of RenderImageTile
Code: Select all
{
"imageInfo": {
"fileInfo": {
"id": "23089769.tif",
"password": null
},
"pageIndex": 0
},
"tileSize": {
"width": 1024,
"height": 1024
},
"imagePoint": {
"x": 0,
"y": 0
},
"scale": {
"x": 0.32,
"y": 0.32
},
"useVectorRendering": false,
"useCache": true,
"renderNeighbourTiles": true,
"imageType": 1,
"sessionId": "d3dba302-69f9-bbf6-cadc-e43a5d616cc8"
}
Page 2 Request of RenderImageTile
Code: Select all
{
"imageInfo": {
"fileInfo": {
"id": "23089769.tif",
"password": null
},
"pageIndex": 1
},
"tileSize": {
"width": 1024,
"height": 1024
},
"imagePoint": {
"x": 0,
"y": 0
},
"scale": {
"x": 0.48,
"y": 0.48
},
"useVectorRendering": false,
"useCache": true,
"renderNeighbourTiles": true,
"imageType": 1,
"sessionId": "d3dba302-69f9-bbf6-cadc-e43a5d616cc8"
}
Thanks
Jwalit Katira
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Get scale value during DeserializeAnnotationCollections in .net core api using web document viewer
Hello,
Why are you processing the annotations manually?
Best regards, Alexander
The WebAnnotationViewerJS class can display images with annotations.... so on every next page i get annotation and display it in image as response ...
Why are you processing the annotations manually?
Best regards, Alexander
-
- Posts: 31
- Joined: Mon Sep 18, 2023 1:41 pm
Re: Get scale value during DeserializeAnnotationCollections in .net core api using web document viewer
Hi Alex,
Please note that we are getting annotation's data: x, y, height & width from another document processing NLP service. We are calculating and providing annotation x & y data based on current page's scale value. Our document has multiple pages with different page size (height & width), so each document's page would have different scale value. So if we do not calculate annotation x & y based on scale value then annotation position would differ with actual one provided by NLP service.
So if we do not get scale value from DeserializeAnnotationCollections API then let us know how can we calculate the scale value through C# code if we already have x, y, height and width of current page?
Please below screen-cast for your reference.
https://advantstorage1.blob.core.window ... ording.mp4
Thanks
Jwalit Katira
Please note that we are getting annotation's data: x, y, height & width from another document processing NLP service. We are calculating and providing annotation x & y data based on current page's scale value. Our document has multiple pages with different page size (height & width), so each document's page would have different scale value. So if we do not calculate annotation x & y based on scale value then annotation position would differ with actual one provided by NLP service.
So if we do not get scale value from DeserializeAnnotationCollections API then let us know how can we calculate the scale value through C# code if we already have x, y, height and width of current page?
Please below screen-cast for your reference.
https://advantstorage1.blob.core.window ... ording.mp4
Thanks
Jwalit Katira
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Get scale value during DeserializeAnnotationCollections in .net core api using web document viewer
Hi Jwalit,
Thank you for information.
You are approaching the problem from the wrong side. You need to provide information about annotations on the server-side instead of rendering annotations in web image viewer on the client side.
In other words you need to do the following steps:
Thank you for information.
You are approaching the problem from the wrong side. You need to provide information about annotations on the server-side instead of rendering annotations in web image viewer on the client side.
In other words you need to do the following steps:
- Create MyVintasoftAnnotationCollectionWebService class that is derived from VintasoftAnnotationCollectionWebService class.
- Override the GetAnnotationCollectionFromDataStorage method in the MyVintasoftAnnotationCollectionWebService class if you need to load annotations from custom storage (NLP service).
- Override the SaveAnnotationCollectionToDataStorage method in the MyVintasoftAnnotationCollectionWebService class if you need to save annotations to the custom storage (NLP service).
- Use the MyVintasoftAnnotationCollectionWebService class as web service for annotations in your web application.