asp.net - Set images on Pdf using itextsharp -


i working on wcf service create pad file , want set image on created pdf. below code. gives me error "object reference not set object instance"

 string str = system.web.httpcontext.current.request.mappath("app_data/suc.png");  image imgcheckboxchecked = image.getinstance(str);  

the other thing try , gives me error :could not find file 'c:\program files\common files\microsoft shared\devserver\10.0\suc.png: below other code

  image imgcheckboxchecked = image.getinstance("app_data/suc.png");    cell.addelement(imgcheckboxchecked);   cell.colspan = 4;   table.addcell(cell); 

any idea on how solve error , set image on pdf. thanks

you can use appdomain.basedirectory directory main dll, after can use path image dll, path.combine(appdomain.basedirectory, "app_data\\suc.png"), if host service in asp.net, , dll in bin directory can use relative path path.combine(appdomain.basedirectory, "..\\app_data\\suc.png")


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -