-1
我正在使用iTextSharp创建PDF并尝试在PDF的标题中添加图像。代码是这样的图像丢失的大小iTextSharp
public override void OnOpenDocument(PdfWriter writer, Document document)
{
image = iTextSharp.text.Image.GetInstance(HttpContext.Current.Server.MapPath("~/Content/images/HSBC/hsbc.png"));
image.ScaleAbsoluteHeight(25);
image.ScaleAbsoluteWidth(134);
image.SetAbsolutePosition(38, 800);
}
注意:实际的图像大小是高度:25px和宽度:134px。这就是我分别在image.ScaleAbsoluteHeight(25)
和image.ScaleAbsoluteWidth(134)
中给出的。
但我不明白为什么在生成PDF时图像变大,而且看起来很糟糕。
感谢