Inserting images depends on what DB you are using.

For printing, you can use java print classes, java.awt.print.*. Try the
following code:

public void printMyImage()
{
         PrinterJob printJob = PrinterJob.getPrinterJob();
         printJob.setPrintable(this);
         if (printJob.printDialog())
         {
                 try
                 {
                         printJob.print();
                 }
                 catch (Exception ex)
                 {
                         ex.printStackTrace();
                 }
         }
}

public int print(Graphics g, PageFormat pf, int pi) throws PrinterException
{
         Image img = Toolkit.defaultToolkit.getImage("test.jpg");

             if (pi >= 1) {
             return Printable.NO_SUCH_PAGE;
         }

         Rectangle rect = g.getClipBounds();
         g.drawImage(img,
                         (int)rect.getX(), (int) rect.getY(),
                         (int) rect.getWidth(),
(int)                    rect.getHeight(),
                         this);

         return Printable.PAGE_EXISTS;
}

The class where you do the printing from should implement the Printable
interface.

Gopi
> > Hi all
> > i have a problem with images.. how can i to do to insert in my Database
>with
> > Blob class and how can i do to get this image.... my image is jpg..
>another
> > thing how can i to print it
> > thanks
> >
> > Christian Hamann Linares
> > Area de Desarrollo de Aplicaciones
> > FICS-DATA USMP
> > e-mail: [EMAIL PROTECTED]
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, December 27, 2000 8:37 PM
> > Subject: Returned mail - agrino.org
> >
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


-----------
Gopi Mandava                            (703) 267-1735 x307
CoManage Inc.

"I don't think God put me on this planet to judge others. I think he put me
on this planet to gather specimens and take them back to my home planet."

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to