Re: Drawing images with PDFDocumentGraphics2D
I was curious and tried your code. Look like the drawImage method in question isn't implemented in PDFGraphics2D.java. This is fixed in cvs, just moved some code. I modified your code and got a image in PDF when I did the following: while(!PDFGenerator1.drawImage(img, 400, 300, panel)) { Thread.sleep(200); } The TestPDFGen now works with both draw image methods provided you wait on the observer as above. Not in the right place and with the right size, but the image nonetheless. Looks like Graphics2D.java still needs a little work. Also, maybe using System.out to create PDFs using FOP may not be the best idea because there are still some System.out.println statements scattered around the codebase. Maybe that helps. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Drawing images with PDFDocumentGraphics2D
Thanks a lot for your help. That worked indeed! Julio - Original Message - From: Jeremias Maerki [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:50 AM Subject: Re: Drawing images with PDFDocumentGraphics2D I was curious and tried your code. Look like the drawImage method in question isn't implemented in PDFGraphics2D.java. I modified your code and got a image in PDF when I did the following: while(!PDFGenerator1.drawImage(img, 400, 300, panel)) { Thread.sleep(200); } Not in the right place and with the right size, but the image nonetheless. Looks like Graphics2D.java still needs a little work. Also, maybe using System.out to create PDFs using FOP may not be the best idea because there are still some System.out.println statements scattered around the codebase. Maybe that helps. On 27.03.2003 00:49:11 jcplerm wrote: I am sending attached to this message a small test case that should reproduce the problem. I am loading the image with Toolkit.getDefaultToolkit().getImage and then I pass that image to the drawImage method, along with new Panel() as an observer. By running java TestPDFGenx.pdf I get only a single square on the page, without the image. I would be very grateful if you could take a look into this and see what I am doing wrong. Jeremias Maerki - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Drawing images with PDFDocumentGraphics2D
Thanks, Keiron! - Original Message - From: Keiron Liddle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 27, 2003 6:07 PM Subject: Re: Drawing images with PDFDocumentGraphics2D I was curious and tried your code. Look like the drawImage method in question isn't implemented in PDFGraphics2D.java. This is fixed in cvs, just moved some code. I modified your code and got a image in PDF when I did the following: while(!PDFGenerator1.drawImage(img, 400, 300, panel)) { Thread.sleep(200); } The TestPDFGen now works with both draw image methods provided you wait on the observer as above. Not in the right place and with the right size, but the image nonetheless. Looks like Graphics2D.java still needs a little work. Also, maybe using System.out to create PDFs using FOP may not be the best idea because there are still some System.out.println statements scattered around the codebase. Maybe that helps. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Drawing images with PDFDocumentGraphics2D
Hi, The ImageObserver is used in the getWidth, getHeight and drawImage methods with the image that is passed in. So in a sense it depends on the img that you are passing in. The observer is an object waiting for the image to be loaded. How are you creating the image, can you get an abserver from there somehow. Maybe you could use a dummy observer if the image is already loaded. Keiron. How can I obtain an java.awt.ImageObserver that I can pass to one of the drawImage methods of PDFDocumentGraphics2D? Example: pdfgen = new PDFDocumentGraphics2D(true,System.out,800,1100); ... pdfgen.drawImage(img,100,100,50,50,imgObserver); With a pure AWT application, I would pass the java.awt.Panel whose paint method invokes drawImage. But with PDFDocumentGraphics2D, I don't have such a Panel object. Even if I create a surrogate one, the resulting PDF will not have the images in it. What can act as the ImageObserver? Thanks, Julio Lerm Chicago, IL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Drawing images with PDFDocumentGraphics2D
I guess there were problems with the attachment of my last e-mail... Here are the files again, this time in text format. Thanks, Julio Lerm - Original Message - From: jcplerm [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 5:49 PM Subject: Re: Drawing images with PDFDocumentGraphics2D Keiron, I am sending attached to this message a small test case that should reproduce the problem. I am loading the image with Toolkit.getDefaultToolkit().getImage and then I pass that image to the drawImage method, along with new Panel() as an observer. By running java TestPDFGenx.pdf I get only a single square on the page, without the image. I would be very grateful if you could take a look into this and see what I am doing wrong. Thanks a lot, Julio - Original Message - From: Keiron Liddle [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 26, 2003 5:02 PM Subject: Re: Drawing images with PDFDocumentGraphics2D Hi, The ImageObserver is used in the getWidth, getHeight and drawImage methods with the image that is passed in. So in a sense it depends on the img that you are passing in. The observer is an object waiting for the image to be loaded. How are you creating the image, can you get an abserver from there somehow. Maybe you could use a dummy observer if the image is already loaded. Keiron. How can I obtain an java.awt.ImageObserver that I can pass to one of the drawImage methods of PDFDocumentGraphics2D? Example: pdfgen = new PDFDocumentGraphics2D(true,System.out,800,1100); ... pdfgen.drawImage(img,100,100,50,50,imgObserver); With a pure AWT application, I would pass the java.awt.Panel whose paint method invokes drawImage. But with PDFDocumentGraphics2D, I don't have such a Panel object. Even if I create a surrogate one, the resulting PDF will not have the images in it. What can act as the ImageObserver? Thanks, Julio Lerm Chicago, IL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] attachment: Glob.JPEGattachment: setenv.bat TestPDFGen.java Description: Binary data TestPDFGen.class Description: Binary data - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Drawing images with PDFDocumentGraphics2D
How can I obtain an "java.awt.ImageObserver" that I can pass to one of the "drawImage" methods of PDFDocumentGraphics2D? Example: pdfgen = new PDFDocumentGraphics2D(true,System.out,800,1100); ... pdfgen.drawImage(img,100,100,50,50,imgObserver); With a pure AWT application, I would passthejava.awt.Panel whose "paint" methodinvokes"drawImage". But with PDFDocumentGraphics2D, I don't have such a Panel object. Even if I create a surrogate one, the resulting PDF will not have the images in it. What can act as the "ImageObserver"? Thanks, Julio Lerm Chicago, IL