The code looks correct to me. I am just about out of ideas on this. If other
applications are able to print to this printer successfully, then this
should work. Have you tried the PS renderer yet? The JDK printing API should
not come in to play on this. We are sending the print data directly to the
printer. I am still a little suspicious that something between FOP and the
printer is filtering the stream. As a sanity check I would try connecting
the printer locally to see if it works any better.
Sorry I could not be more helpful,
Art
-----Original Message-----
From: Hitesh Bagchi [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 3:58 AM
To: [EMAIL PROTECTED]
Subject: Re: Help in XML Rendering to PostScript
I tried setting the PJL ENTER LANGUAGE = PCL
and then sending the output to the printer but the printer printed the same
old
junk characters it was doing earlier
Here is my piece of code:
>>--------------------------------------------------------------------------
--------------
FileOutputStream fos = new FileOutputStream("\\\\Melstar\\Melprn");
fos.write("\033%-12345X@PJL ENTER LANGUAGE = PCL\r\n".getBytes());
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();
fos.write("\033%-12345X@PJL ENTER LANGUAGE = POSTSCRIPT\r\n".getBytes());
fos.close();
----------------------------------------------------------------------------
------------<<
I used the jdk 1.4 beta which has much better printing support than it's
predecessors and used it's
new java printing service API to query my printer. Whichever way I query my
printer it always tells
me that the supported file format to print is gif, jpeg and png.
If I try to set the DocFlavor as POSTSCRIPT or PDF it throws me an
exception.
I hitting a dead end it seems.
Thanks,
Hitesh
Art Welch wrote:
> I think that it is probably most likely that something is altering the
> escape characters in the print stream before the printer gets it. The text
> renderer of course has no escape characters in it's output.
>
> If your printer was PS only then the plain text output would not have
> printed correctly either (unless something interpreted it for the
printer).
> PCL however will print plain text properly (depending on line feeds and
form
> feeds being appropriate).
>
> OK! I just did some more looking on the HP site and it looks like the 6MP
> should support both PCL and PostScript. If the default is PS and you want
to
> leave the printer that way then you may need to use the PJL commands to
> switch the language in software (see
> http://www.hp.com/cposupport/printers/support_doc/bpl01378.html). If you
> want to try this, after you open the file output stream you would write
the
> enter language PCL command "\033%-12345X@PJL ENTER LANGUAGE = PCL\r\n" to
> the output stream before giving the stream to Driver. After Driver has
> rendered the PCL you could reset the language to PS before closing the
> stream with "\033%-12345X@PJL ENTER LANGUAGE = POSTSCRIPT\r\n".
>
> I hope that this solves the problem for you,
> Art
>
> -----Original Message-----
> From: Hitesh Bagchi [mailto:[EMAIL PROTECTED]]
> Sent: Friday, June 22, 2001 3:56 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Help in XML Rendering to PostScript
>
> also if I use
> driver.setRenderer(Driver.RENDER_TXT);
> and send the output to the printer straight away the printer is able to
> understand
> the output and is able to print the text output. But the quality of the
> output
> falls far short of what a pdf output can provide.
>
> Thanks,
> Hitesh
>
> Hitesh Bagchi wrote:
>
> > 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]
>
> ---------------------------------------------------------------------
> 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]