计算iTextSharp的PDF文档的高度? [英] Calculate height of iTextSharp PDF document?
问题描述
我如何使用iTextSharp的计算时,PDF文档的高度?
我使用iTextSharp的对使用绝对位置的PDF文档放置各种图像。不过我注意到 SetAbsolutePosition()
位置从底部是
参数,所以我需要计算的高度能够做到这样的:
Y = PdfHeight - 我
您应该能够通过使用每页,这样做...
INT yPos = pdfDocument.PageSize.Height - 我 - elementHeight;
我=您将设置Ÿ如果是从页
顶部的位置elementHeight =你定位元素(例如图像)的高度
How can I calculate the height of the PDF document when using iTextSharp?
I'm using iTextSharp to position various images on a PDF document using Absolute Position. However I've noticed SetAbsolutePosition()
positions the Y
parameter from the bottom, so I need to calculate the height to be able to do something like:
Y = PdfHeight - i
You should be able to do that by using the PageSize, like this...
int yPos = pdfDocument.PageSize.Height - i - elementHeight;
i = the position you would set Y if it was from the top of the page
elementHeight = the height of the element you are positioning (e.g. an image)
这篇关于计算iTextSharp的PDF文档的高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!