0 Replies Latest reply: Apr 8, 2008 9:43 AM by 807591 RSS

    javax print :  printing a text file

    807591
      Hello all,
      I want to print a text file using Java Print Service. This is the code I use :
      PrintService printService = PrintServiceLookup.lookupDefaultPrintService();
      DocPrintJob job = printService.createPrintJob();
      FileInputStream fin = new FileInputStream("C:/tmp/printTests/outputsettings.xml");
                     
      DocAttributeSet attributes = new HashDocAttributeSet();
      attributes.add(MediaSizeName.ISO_A4);
      Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.AUTOSENSE, attributes);
      
      PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
      pras.add(new Copies(1));
      pras.add(MediaSizeName.ISO_A4);
      job.print(doc, pras);
      fin.close();
      I would like to customize the output : change the used font (or just font size), and moreover cut the lines larger than the print media size to print the entire document on the sheet. How can I do that ?

      Thanks in advance.