I used the following piece of code to send the pcl output to the printer(HP
Laser Jet 6P/6MP network printer):

  FileOutputStream fos = new FileOutputStream("\\\\Melstar\\Melprn");
  Driver driver = new Driver();
  driver.setRenderer(Driver.RENDER_PCL);
  driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
  driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
  driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
  driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
  driver.setOutputStream(fos);
  driver.buildFOTree(parser, new InputSource(args[0]));
  driver.format();
  driver.render();

And everything went smoothly.
Only the printer printed a lot of junk characters like you would get if you
write the pcl output to a file and send the file to a printer as a text file.
Does it mean my printer do not understand pcl output.

Thanks,
Hitesh





Art Welch wrote:

> I am not sure if I have the syntax exactly correct (and I do not have FOP
> installed on my Windows 2000 or NT workstations at the moment), but in the
> past I have successfully printed directly to a network printer, just by
> opening a file stream to it. For example in your example only the first line
> would need to change something like:
>
>     FileOutputStream fos = new
> FileOutputStream("\\\\hostname\\printername");
>
> For a local printer you should be able to do something like:
>
>     FileOutputStream fos = new FileOutputStream("lpt1");
>
> HTH,
> Art
>
> -----Original Message-----
> From: Hitesh Bagchi [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 21, 2001 12:35 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Help in XML Rendering to PostScript
>
> I am using windows NT and I am trying to print the PCL output directly to
> the
> printer which is a
> HP Laser Jet 6P/6MP network printer from my application. Here is my piece of
> code :
> >>--------------------------------------------------------------------------
> -----------------------
>
>     FileOutputStream fos = new FileOutputStream("../temp/tTest.pcl");
>     Driver driver = new Driver();
>     driver.setRenderer(Driver.RENDER_PCL);
>     driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
>     driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
>     driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
>     driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
>     driver.setOutputStream(fos);
>     driver.buildFOTree(parser, new InputSource(args[0]));
>     driver.format();
>     driver.render();
> ----------------------------------------------------------------------------
> -----------------------<<
>
> Now instead of printing to the Test.pcl file I want to send the output
> directly
> to the HP Laser Jet 6P/6MP
> printer on the network.
>
> Thanks,
> Hitesh
>
> Art Welch wrote:
>
> > I thought that I had answered a question about direct printing PCL
> recently.
> > If you will tell me what platform you are using (Windows/Unix) and how you
> > are invoking FOP (application or command line). I will try to answer this.
> >
> > Art
> >
> > -----Original Message-----
> > From: Hitesh Bagchi [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, June 16, 2001 1:50 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Help in XML Rendering to PostScript
> >
> > Hello,
> > Can somebody tell me how to stream PCL output to a network printer without
> > writing to a file.
> >
> > Thanks,
> > Hitesh
> >
> > [EMAIL PROTECTED] wrote:
> >
> > > Hello,
> > >
> > > I am fairly new to FOP and to Java as well.  I am wondering if anyone
> has
> > > written a rendering to convert an XML stream to Postscript with FOP
> > (similar
> > > to the PCL or PDF renderer) - I am in desperate need of a mechanism to
> do
> > > this.  We have a current Java app that converts an XML stream into PDF,
> > but
> > > printing through Adobe Acrobat is too resource intensive on the lower
> end
> > > machines.  I have tried converting to PCL and then streaming to a port,
> > > which works pretty well, but is not a 100% compatibile (PCL beng only
> HP)
> > >
> > > If anyone knows of a way to convert an XML to PS format using a custom
> FOP
> > > piece they've written, or knows of a better mechanism, I'd be forever
> > > grateful!
> > >
> > > Thanks very much,
> > >
> > > Tony
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, email: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, email: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to