将图像设置为Itextsharp.text.cell抛出错误



当我将图像设置为单元格

时,我有一个问题
Dim CellAux As PdfPCell
CellAux = New PdfPCell(Image.GetInstance("../../Common/Images/image_logo.gif"))
并抛出下一个错误:cant find path c:windowsCommonImagesimage_logo.gif

为什么在那里寻找图像?

我怎么做才能在正确的目录中搜索图像?

当你运行一个应用程序时,你总是在工作目录下运行它。这不一定是你想要的目录。在任何情况下,您都在代码中使用相对路径,并且绝对路径将使用该相对路径与您的工作目录相结合来构建。本例的结果是c:windowsCommonImagesimage_logo.gif

最新更新