Hi
I am trying to write a pdf  document printer severlet in j2ee
environment.The severlet will get a pdf  document from client ,and then  I
want  to  print this  pdf document automatically.
I have used PDDocument object's load(filename) method and silentPrint()
method.Firstly I wrote a java class which run in console.It is
sucessful! Then I used the same class  in j2ee environment,It is fail!There
is no error ,no printer job queued,no exception.
 I want to know that  how to use the  PDDocument object's silentPrint()
method  in j2ee environment?

My code:
public class UpLoadAction extends Action {

  public ActionForward execute(ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
      throws Exception
   {

  String  filePath = http://localhost:8080/project/pages/1.pdf;
  try
  {
   PDDocument pdfDocument = PDDocument.load(new URL(filePath));
            pdfDocument.silentPrint();
  }
  catch (Exception e)
  {
   return null;
  }

        return mapping.findForward("display");
  }
}
Thank you for reading

Reply via email to