Try the FileImageResource class mentioned here (by me :): http://www.nabble.com/Mount-files-outside-container-td19232069.html
On Tue, Oct 14, 2008 at 3:09 PM, Dane Laverty <[EMAIL PROTECTED]> wrote: > I'm adding an image to my page with the following code. It works > correctly, and the image displays fine. However, we are getting reports > from some IE users that the image will not print. It prints fine for > most IE users, but there are a handful who can't get it to print. > > > > While I don't know the reason, I did notice that when you right-click > the image and "Save As...", it doesn't have a name. In IE, the Save As > dialog calls it "untitled.bmp" (in spite of it being a png) and in > Firefox it's "print.png". Perhaps this is the source of the issue? If > so, how do you give an image a name when you're adding it as a Resource? > > > > (For anyone who's interested in looking, you can find the offending > image at http://foodhandler.org. Log in with username/password > "guest/guest". Then click the "Print Your Card" button on the navigation > bar. When you print the page, the only two images that should print are > the "Thawte 100% Secure" image at the top of the page and the card image > in the center of the page - the rest are turned off in a print > stylesheet.) > > > > PrintPage.java: > > > > public class PrintPage extends NavigationTemplate > > { > > public PrintPage() > > { > > Resource cardImage = getBothCardImageResource(); > > add(new NonCachingImage("bothCardImage", cardImage)); > > > > } > > > > public Resource getBothCardImageResource() > > { > > final BufferedDynamicImageResource resource = new > BufferedDynamicImageResource(); > > BufferedImage image; > > > > try { > > image = ImageIO.read(((WebApplication) > Application.get()).getServletContext().getResourceAsStream("/path/to/MyI > mage.png")); > > > > Graphics graphics = image.getGraphics(); > > ... Do some stuff with the graphics ... > > } > > > > resource.setImage(image); > > return resource; > > } > > } > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]