writeChar(sb.toString());
writeBuffer(sb.toString());
   private void cvtToPDF() {      try {         openOutputFile();         // Create the printparameters to be used in the transform of the         //    input stream         PrintParameterList printParms = new PrintParameterList();         printParms.setParameter(PrintObject.ATTR_WORKSTATION_CUST_OBJECT,         "/QSYS.LIB/QWPDEFAULT.WSCST");         printParms.setParameter(PrintObject.ATTR_MFGTYPE, "*WSCST");         // get the text (via a transformed input stream) from the spooled file         PrintObjectTransformedInputStream inStream = splfile.getTransformedInputStream(printParms);         BufferedReader br = new BufferedReader(                    new InputStreamReader(inStream));         // get the number of available bytes         int avail = inStream.available();         byte[] buf = new byte[avail + 1];         int read = 0;         int totBytes = 0;         StringBuffer sb = new StringBuffer();         updateStatus("Starting Output");         // read the transformed spooled file, creating the jobLog String         while (avail > 0) {            if (avail > buf.length) {               buf = new byte[avail + 1];            }            read = inStream.read(buf, 0, avail);            for (int x = 0; x < read; x++) {               switch (buf[x]) {                  case 0x0:      // 0x00                     break;                  // write line feed to the stream                  case 0x0A://                     writeChar(sb.toString());                     sb.append((char)buf[x]);//                     System.out.print(sb);//                     sb.setLength(0);                     break;                  // we will skip the carrage return                  case 0x0D://                     sb.append('\n');//                     writeChar("\n");//                     System.out.println();                     break;                  // new page                  case 0x0C:                     writeChar(sb.toString());                     document.newPage();                     sb.setLength(0);                     break;                  default:                     sb.append((char)buf[x]);               }            }            totBytes += read;            updateStatus("Bytes read " + totBytes);            //            // process the data buffer            //            avail = inStream.available();         }         closeOutputFile();         updateStatus("Total bytes converted " + totBytes);         if (email.isSelected())            emailMe();        }        catch (Exception e) {           updateStatus("Error: " + e.getMessage ());           System.out.println ("Error: " + e.getMessage ());        }   }