pdf中的图像不显示(iTextSharp)

时间:2016-10-14 10:10:31

标签: c# image pdf itext

我正在添加图片,但它没有正确显示,我无法理解原因。

我尝试了两种方式添加图片。 (article about add pictures

第一种方式:

 iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(xmlNode.ChildNodes[i].Attributes["path"].Value);
第二种方式:

using (FileStream fs = new FileStream(xmlNode.ChildNodes[i].Attributes["path"].Value, FileMode.Open))
{
    iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance(System.Drawing.Image.FromStream(fs), ImageFormat.Png);

    doc.Add(png);
}

我的PDF中的所有时间都是这样的: enter image description here

谢谢!

0 个答案:

没有答案
相关问题