Hi,
At my java applet application, i am still getting the below error
% selected printer \\10.10.8.63\HP LaserJet 1200 Series PCL
Apr 27, 2010 12:18:47 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFO: unsupported/disabled operation: BDC
Apr 27, 2010 12:19:02 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFO: unsupported/disabled operation: EMC
Apr 27, 2010 12:19:03 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFO: unsupported/disabled operation: BDC
Apr 27, 2010 12:19:03 PM org.apache.pdfbox.util.PDFStreamEngine
processOperator
INFO: unsupported/disabled operation: EMC
% Print is sent
Below is the applet code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.me.tray;
import java.applet.Applet;
import java.io.*;
import java.net.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.print.attribute.standard.*;
import java.awt.Graphics;
//import jxl.*;
//import java.awt.print.PrinterJob;
//import com.qoppa.pdf.PrintSettings;
//import com.qoppa.pdfPrint.PDFPrint;
//import java.awt.print.PrinterException;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import javax.print.PrintService;
import org.apache.pdfbox.pdmodel.PDDocument;
public class PrintToTray extends Applet {
/**
* Initialization method that will be called after the applet is loaded
* into the browser.
*/
StringBuffer strBuffer = new StringBuffer();
String msg = new String();
//Integer flag = new Integer(0);
Integer y = new Integer(10);
public void init()
{
PDDocument document = null;
try
{
document = new PDDocument();
URL url = new URL("http://localhost/test/Fatura.pdf");
document = PDDocument.load(url);
PrinterJob printJob = PrinterJob.getPrinterJob();
PrintService service =
PrintServiceLookup.lookupDefaultPrintService();
if (service != null)
{
msg = " % selected printer " + service.getName();
strBuffer.append(msg);
repaint();
showMsg(msg);
printJob.setPrintService(service);
HashPrintRequestAttributeSet attrSet = new
HashPrintRequestAttributeSet();
attrSet.add(MediaSizeName.ISO_A4);
attrSet.add(MediaTray.BOTTOM);
attrSet.add(new Copies(1));
printJob.setPageable(document);
printJob.print(attrSet);
//document.print(printJob);
msg = " % Print is sent";
strBuffer.append(msg);
repaint();
showMsg(msg);
document.close();
}
else
{
msg = " % No printer found ";
strBuffer.append(msg);
repaint();
showMsg(msg);
}
}
catch (IOException ioe)
{
//strBuffer.append("%" + ioe.toString());
//repaint();
showMsg(ioe.toString());
}
catch (PrinterException pe)
{
//strBuffer.append("%" + pe.toString());
//repaint();
showMsg(pe.toString());
}
finally
{
try
{
if (document != null)
{
document.close();
}
}
catch (IOException ioe)
{
//strBuffer.append("%" + ioe.toString());
//repaint();
showMsg(ioe.toString());
}
}
}
public void showMsg(String msg)
{
System.out.println(msg);
}
public void paint(Graphics g)
{
g.drawRect(0, 0,getWidth() - 1, getHeight() - 1);
//g.drawString(strBuffer.toString(), 10, 10);
for (int i=1; i<strBuffer.length(); i++)
{
if (strBuffer.charAt(i) == '%' )
{
int next = strBuffer.indexOf("%", i+1);
if (next != -1)
{
y += 10;
String msg = strBuffer.substring(i, next);
g.drawString(msg, 10, y);
}
else
{
y += 10;
String msg = strBuffer.substring(i,strBuffer.length());
g.drawString(msg, 10, y);
}
}
}
}
}
I am also adding the PDF i use at my localhost
http://www.2shared.com/file/12864694/349c70ba/Fatura.html
What can be the problem? Does the 1.1.0 version include the fix for encoding
related with above error?
Thanx.
--
Oguz Yarimtepe <[email protected]>