Maintain similar image size in PDF using itextsharp

*爱你&永不变心* 提交于 2019-12-02 03:57:24

I completely forgot about this question, but I'll answer it now for further reference. iTextSharp resizes images automatically (which is what you'd want in most cases), but you can avoid this by setting ScaleToFitHeight = false to each image.

phrase2.Add(new Chunk("1.", normalFont));
Byte[] bytes1 = (Byte[])dr[10];
iTextSharp.text.Image image1 = iTextSharp.text.Image.GetInstance(bytes1);
image1.ScaleToFit(750f, 750f);
//set scale to fit height = false
image1.ScaleToFitHeight = false;
Chunk imageChunk1 = new Chunk(image1, 0, -30);
phrase2.Add(imageChunk1);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!