At 5:24 PM -0700 5/1/02, Ramakrishna Kuppa wrote: >I am creating a PDF report dynamically. I have some images which >need to be inserted into the document. I am trying to use the Gif >class to load the image; however, it needs a URL to the image. How >can I specify this during development and distributed deployment? > >Having gone thru' the HELP docs. and the API, I felt that the Image >API should be expanded to take in the document root and a relative >path and return a suitable instance.
There are already many useful ways to obtain and compose URLs in the core Java API. For example, if you are getting your image from a file, you can construct a File object representing your base path, and then use the File(File, String) constructor to obtain various relative paths off that. File has a handy toURL() method that will get you the URL you need. Similarly, you can construct a base URL class and then construct relative paths from it. Finally, consider the Class.getResource(String) method (which returns an URL) as a great way to locate image files in a portable manner that will not need to change regardless of whether your image in an a file system, packed into a JAR file, or even being fetched across the network. Consult the core API Javadoc for more information. -- ______________________________________________________________________ Wilhelm Fitzpatrick | When we speak of free http://www.3roses.com/ | software we are referring [EMAIL PROTECTED] | to freedom not price. _______________________________________________________________ Have big pipes? SourceForge.net is looking for download mirrors. We supply the hardware. You get the recognition. Email Us: [EMAIL PROTECTED] _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions