How to access the image file from project folder itself while writing to pdf using itext?

Ads
Ads

How to access the image file from project folder itself while writing to pdf using itext?


Reuben Mathew
How to access the image file from project folder itself while writing to pdf using itext?
0 Answer(s)      6 years ago
Posted in : Java Beginners
Ads

I am writing a pdf using itext where i add a image in the beginning of the document. When i use

image = Image.getInstance("C:\\company.jpg");

it works fine But when i use this code

image = Image.getInstance("items\\company.jpg");

it doesnt work.How do i accomplish that task? It tries to search for the image in the domain folder of the glassfish location.But i want it to pick it up from the project folder itself.Because later i deploy the project in a linux server where i cannot give a path of windows.So please help me accomplish this.I am using simple java program to write the pdf.Not a servlet.Thanks

View Answers
Ads









Related Tutorials/Questions & Answers:
Advertisements