我正在使用ItextSharp庫在按鈕上生成PDF文件,單擊我的SharePoint網站。我想在圖片駐留在Sharepoint的圖片文件夾上的pdf上使用徽標。我無法做到這一點。要加載到從Sharepoint服務器映像文件夾創建的pdf文件中的圖像
有人可以幫助我。
下面是我正在使用的代碼,它是從window32獲取我不想要的實例。
protected void button1_OnClick(object sender, EventArgs e)
{
Font Arial = FontFactory.GetFont("Arial", 12, BaseColor.GREEN);
Font Verdana = FontFactory.GetFont("Verdana", 16, Font.BOLDITALIC, new BaseColor(125, 88, 15));
string imagepath = SPContext.Current.Web + "/_layouts/Images/Image1.png";
using (var ms = new MemoryStream())
{
using (var document = new Document(PageSize.A4,50,50,15,15))
{
PdfWriter.GetInstance(document, ms);
document.Open();
Paragraph img = new Paragraph();
Image jpg = Image.GetInstance(imagepath); --- Getting an error here stating "Could not find a part of the path 'c:\windows\system32\inetsrv\CustomSystem\_layouts\Images\Image1.png'"
img.Add(jpg);
}
}
}
請幫忙!
感謝您的回覆,我把它通過利用字符串的ImagePath = Page.Server.MapPath的工作( 「/ _佈局/圖片/ ImageFolder/Image1.gif」); – Janet