0

I have a document which containing some elements. The document is an INDD document. I am trying to show it in a webview but in a smaller size than the original size. I am using ImageMapper (ASP.NET) to mark the different elements in the webview. The problem is that I don´t get the correct positions in of the different spots in the webview. I got the correct size of the new spots but not the position. I made the calculations in the following way:

Original size (INDD document)
DocumentWidth = 768
DocumentHeight = 1024
New Size (Size of the webview)
Width = 522
Height = 696

percentW = newWidth(Webview)/DocumentWidth
percentH = newHeight(Webview)/DocumentHeight;

From these percent values I am calculating all the new values I will need in the ImageMapper (top,left,bottom,right).

Formula for that

myPrecent = (percentW/percentH) * 100;
        result =  myPrecent * ((top,left,right,bottom) / 100);

The result variable shall represent the new value which will be used in the spots within ImagMapper.

I suppose that I am thinking wrong in my calculation but I cant figured out what I´m doing wrong. So I will be appreciate if someone has any idea what I have doing wrong.

kmatyaszek
  • 19,016
  • 9
  • 60
  • 65

1 Answers1

0

don't think of them as percentages, instead, think of them as scaling factors.

verticalScaling = Height/DocumentHeight
horizontalScaling = Width/DocumentWidth

newTop = Top * verticalScaling
newLeft = Left * horizontalScaling
newBottom = Bottom * verticalScaling
newRight = Right * horizontalScaling
Kevin
  • 704
  • 3
  • 4
  • Thanks for your help! But I actually got the same values from these calculation. I think the problem is with the X and Y position in the webview comparing to the INDD document. I am using an asp:Image control in the webview. – Tobias Tångfelt Sep 21 '12 at 06:36