开发者

iTextSharp image keep pixel dimensions?

Lets say I have an image that has a DPI of 72 and a width/height of 100px/100px.

However when I add the image and render the PDF, the image that is displayed is bigger than 100px/100px. How can I ensure that the when adding the image to the PDF using iTextSharp that I keep the same pixel dimensions as the original image, in this case开发者_JS百科 100px/100px?


It sounds like you'll want to check out the ScaleAbsolute method of the iTextSharp.text.Image, which will explicitly set the height/width of an image. There are a couple of related methods you'll want to read up to: ScalePercent and ScaleToFit.

These methods are described in the SourceForge iTextSharp tutorial which includes samples. See tge "Scaling and Rotating the Image" section.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜