用新的高度和宽度绘制PDF x和y坐标 [英] Plot PDF x and y co-ordinates with new height and width
问题描述
我正在使用DebenuPDF库生成导出PDF,我的问题与Debenu无关。
在我的网页中,我将渲染静态高度的tiff文件和宽度。在Tiff文件中,用户可以添加注释。高度和宽度示例如下所示
页面高度= 600
页面宽度= 400
>
当用户绘制注释时我正在捕捉X和Y坐标
X坐标= 121.25
Y坐标= 325.90
导出pdf时我必须以tiff文件的原始大小进行操作,用户上传的内容如
页面高度= 1210
页面宽度= 1650
我想知道在哪里绘制注释用户绘制。虽然导出PDF注释是用旧的X和Y坐标绘制的,所以它指向其他一些地方
请有人建议计算X和Y的公式新的高度和宽度。
I'm generating a Export PDF using DebenuPDF library, my question is not related to Debenu.
In my web page I will render tiff file with static height and width. In the Tiff file user can add the annotation. Height and width example as shown below
Page Height = 600
Page Width = 400
While the user plotting the annotation I was capturing the X and Y co-ordinates
X co-ordinate = 121.25
Y co-ordinate = 325.90
While exporting the pdf I have to do it in original size of tiff file what the user uploaded such as
Page Height = 1210
Page Width = 1650
I want to know plot the annotation where the user plotted. While exporting the PDF annotations are plotted with old X and Y co-ordinates so its pointing to some other places
Please anybody suggest the formula to calculate the X and Y co-ordinates with new height and width.
推荐答案
不确定我读得那么好,但是:
如果您的格式从600x400缩放到1210x1650,那么您的X缩放比例为1210/600 = 2,0167,Y缩放比例为1650/400 = 4,125。在您的示例中,假设是线性的,新的x和y坐标将是X = 1210/600 * 121,25 = 244并且Y = 1650/400 * 325,9 = 1340
Not sure I read that well, but:
If your format is scaled from 600x400 to 1210x1650, then you have a X scaling of 1210/600=2,0167 and a Y scaling of 1650/400=4,125. In your example, and assuming linear, the new x and y coordinate would be X=1210/600*121,25=244 and Y=1650/400*325,9=1340
这篇关于用新的高度和宽度绘制PDF x和y坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!