2015-07-21 67 views
0

我修改了here的一些代码,尝试将图像添加到我使用iTextSharp生成的PDF文件中。代码如下:我应该使用哪个引用来解析Image类?

string imagepath = Server.MapPath("Pictures"); 
Image gif = Image.GetInstance(imagepath + "/OfficeUseOnlyImg.png"); 
doc.Add(gif); 

“图像”类无法识别,所以我右键单击以解决它;我吃了一惊与财富的尴尬 - 在Picturelypse的四个参考所有提供他们的服务:

enter image description here

所以,我应该选择哪一个?我认为其中一个iTextSharp参考,但哪一个是首选?

回答

2

iTextSharp.tool.*东西是XML Worker的一部分,而不是iTextSharp核心的一部分。你需要iTextSharp.text.Image

iTextSharp.tool.xml.html.Image类是将<img>标记与iTextSharp.text.Image对象进行映射的类。除非你想调整XML Worker,否则你不应该使用它。