Can't finding JPG file path
800478Apr 16 2008 — edited Apr 18 2008Hi in my application we have to make PDF(itext.jar) with JPG header, I can able to create PDF but while looking for the JPG path, I'm getting the FileNotFoundException.
If I give the following path, then I get the excpetion.
1) Image jpg = Image.getInstance("WebContent//pages//jpg//bg-header.jpg");
document.add(jpg);
then I got
java.io.FileNotFoundException: C:\WebContent\pages\jpg\bg-header.jpg (The system cannot find the path specified.)
2) Image jpg = Image.getInstance("/pages/jpg/bg-header.jpg");
document.add(jpg);
then I got
java.io.FileNotFoundException: C:\pages\jpg\bg-header.jpg (The system cannot find the path specified.)
If I used the following code
3) String jpgFile = request.getContextPath() + "/pages/jpg/sports_header.jpg";
Image jpg = Image.getInstance(jpgFile);
document.add(jpg);
I got the similar
java.io.FileNotFoundException: C:\FiskarsTeacher\pages\jpg\sports_header.jpg (The system cannot find the path specified.)
I might use the wrong path to locate: what is the wright way
could someone give me the solution to find out the path
--------------------
Thanks,
Sumant K