Hi,

 

Thanks for all your quick responses!

I didn't have access to the request object because I packaged all the iText
code in a separate .jar file for reuse.

I solved the problem a bit like you suggest, I added a String parameter to
the interface that specifies the location of the /images directory.

 

Although the image for the pdf is used only in the PDF I would prefer the
include the image in the .jar file. 

If I would try to do Image.getInstance("\\web-inf\\resources\logo.gif
<file:///\\web-inf\resources\logo.gif> ") would it look in the root of the
.jar file? I'm gonna try that.

 

Anyway, this is not really an iText issue, but thank for your help!

 

Bruno, 

Merci voor het voorstel :-) Maar ik red het wel. En ik werk trouwens niet in
het technicum, maar op de zuiderpoort.

Tot ik je es tegen het lijf loop! :-)

 

Greetings,

Kristof.

 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of geronimo
ferreira
Sent: zaterdag 25 augustus 2007 17:33
To: Post all your questions about iText here
Subject: Re: [iText-questions] including images in pdf in web application

 

if you want to put an image on your pdf, you have to do something like this:

 String path = request.getContextPath();
                String split_path[] = path.split("/");
                path = request.getRealPath(split_path[0]);
                 String nof="\\WEB-INF\\RESOURCES\logo.gif";
       
                Image jpeg=null;
                try
                {
                jpeg = Image.getInstance(path+nof);
                jpeg.setAlignment(Image.LEFT);

                doc.add(jpeg);
                }
                catch(Exception e) { System.out.println(e);}

Bruno Lowagie <[EMAIL PROTECTED]> wrote:

Kristof Taveirne wrote:
> Hi,
>
> I'm having some problems loading an image from my /images folder of my 
> web application into the pdf. 
> Where is iText is looking for the image when I try
> logo = Image.getInstance("logo.jpg");
> It didn't even work when I did
> logo =
Image.getInstance("http://localhost:8080/MyProject/images/logo.jpg";);
> Any ideas ?

Can you open the file logo.jpg using nothing more
than java.io.* classes? I'm 99% sure the problem
is not iText related.

> It's the only line of code that is keeping me from finishing this project
J

We have the same employer (at least as long as the
decision to move to SAP Campus Management isn't final).
Ik zit op DICT, maar ik kan gerust eens op mijn fiets
springen en naar het technicum komen om te helpen.

best regards,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

 

  

  _____  

Shape Yahoo! in your own image. Join
<http://us.rd.yahoo.com/evt=48517/*http:/surveylink.yahoo.com/gmrs/yahoo_pan
el_invite.asp?a=7>  our Network Research Panel today! 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to