Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/04/2006, 18:29
Avatar de koyaso
koyaso
 
Fecha de Ingreso: marzo-2006
Mensajes: 8
Antigüedad: 19 años
Puntos: 0
Disculpá la molestía, pero como podría hacerlo? ya que he probado con el siguiente código pero no me imprime nada.

Código PHP:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.print.*;
public class 
Factura extends JApplet implements ActionListener
{
    private 
JButton imprimir;
    public 
void init()
    {
        
ImageIcon icon createImageIcon("printer.gif","Imprimir Factura");
        
imprimir = new JButton("Imprimir Factura"icon);
        
imprimir.addActionListener(this);
        
add(imprimir);
    }
    public 
void Imprimir()
    {
        
String xx=new String("Prueba :: Prueba :: Prueba :: Prueba :: Prueba ::");
        
PrintService service PrintServiceLookup.lookupDefaultPrintService();
        
DocFlavor flavor DocFlavor.BYTE_ARRAY.AUTOSENSE;
        
DocPrintJob pj service.createPrintJob();
        
byte[] bytes;
        
bytes xx.getBytes();
        
Doc doc = new SimpleDoc(bytes,flavor,null);
        try
        {
            
pj.print(doc,null);
        }
        catch(
PrintException e)
        {
            
System.out.println(e);
        }
    }
    public 
void actionPerformed(ActionEvent e)
    {        
        if(
e.getSource()==imprimir)            
            
Imprimir();
    }

Saludos y gracias de antemano.