You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jerry Floyd <jf...@co.la.ca.us> on 2002/08/30 02:32:05 UTC

Targeting FOP PCL output

According to the FOP website at http://xml.apache.org/fop/output.html#, PCL5
is one of the output formats supported by FOP.  We use a servlet running on
a Windows 2000 platform with Oracle 9iAS and Jserv to transform an XML
document into a PDF, which is then displayed by Acrobat Reader in a window,
whence the user may send it to a printer.  This works very well.  But the
users find it too wearisome, so they are now asking us to send the document
directly to their default printers instead, without displaying it in a
browser window.  I have been experimenting with the PCL Renderer, which does
appear to be generating PCL output, but I am unable to control the target of
this output; a standard browser download dialog box pops up that forces me
to either open the file or save it to disk, but does not give me the option
of sending it to a printer.

Now according to the above-cited web page, "You may want to send your output
directly to a printer. The Print renderer uses the java api to print the
document ..." -but I find it difficult to believe this; how would the print
renderer know which printer to direct the document to?  -The web page
continues, "...or you might be able to send the output stream directly to a
printer. If your printer supports postscript you could send the postscript
to the printer. If you have a printer that supports PCL you could stream the
PCL document to your printer. On Windows:

 fop ... -ps \\computername\printer or fop ... pcl \\computername\printer"

This appears to be an evocation of FOP from the command line. How would I
perform this operation from within a servlet?  Has anyone successfully
generated a PCL document and printed it on a client machine's printer, and
are any examples of their work available?  Or, alternatively, is there any
way of printing the PDF directly, without displaying it in a browser window
first?

Thank you
J. L. Floyd, CCHRS Project
Los Angeles County ISD





RE: Targeting FOP PCL output

Posted by "Jason E. Kafer" <je...@ritvax.isc.rit.edu>.
Another way to go about this is to have the java application do the
printing. If it is always going to the default printer, you can use the
JSP api to print directly from the application.   Another advantage of
this is that if the document is large and is going to take a long time
to render you can start the process in its own thread  and have it print
when it is completed rather than having the users browser tied up while
the document is being rendered.

Jason Kafer




-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de] 
Sent: Friday, August 30, 2002 2:32 PM
To: fop-user@xml.apache.org
Subject: Re: Targeting FOP PCL output

Jerry Floyd wrote:
> ...but at the moment I'm only concerned with sending the PCL
> output to my own default printer, and I haven't been able to do that.
A
> blank browser window pops up, followed by a dialog box giving me the
choice
> of saving the file or opening it, but not sending it to a printer.

That's the default reaction of most browsers.
If you are exclusively using Windows platforms and
IEx, you can also tell *all* clients to register
the print action of Acrobat Reader for some extension,
lets say .pnt, and use the same extension for the URL
which retrieves PDF for printing.

> (as you've no doubt been able to divine,
> I'm a raw newcomer to web applications)
You should first sort out what's a server and what's a
client, and what they can do.

J.Pietschmann




Re: Targeting FOP PCL output

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jerry Floyd wrote:
> ...but at the moment I'm only concerned with sending the PCL
> output to my own default printer, and I haven't been able to do that.  A
> blank browser window pops up, followed by a dialog box giving me the choice
> of saving the file or opening it, but not sending it to a printer.

That's the default reaction of most browsers.
If you are exclusively using Windows platforms and
IEx, you can also tell *all* clients to register
the print action of Acrobat Reader for some extension,
lets say .pnt, and use the same extension for the URL
which retrieves PDF for printing.

> (as you've no doubt been able to divine,
> I'm a raw newcomer to web applications)
You should first sort out what's a server and what's a
client, and what they can do.

J.Pietschmann


RE: Targeting FOP PCL output

Posted by Jerry Floyd <jf...@co.la.ca.us>.
Thank you...I have read the message archive but found it somewhat confusing.
We have many thousands of clients, some of whom are behind their own
firewalls, and I don't know that their printers can always be reached from
the network; but at the moment I'm only concerned with sending the PCL
output to my own default printer, and I haven't been able to do that.  A
blank browser window pops up, followed by a dialog box giving me the choice
of saving the file or opening it, but not sending it to a printer.

As for the browser-specific scripting, I have had someone who is
knowledgeable about that helping me (as you've no doubt been able to divine,
I'm a raw newcomer to web applications), but so far without success.
However, I'll try the browser forums; I recognize that this topic may be a
little far afield for this one.

Again, thank you for your help.

> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
> Sent: Friday, August 30, 2002 9:54 AM
> To: fop-user@xml.apache.org
> Subject: Re: Targeting FOP PCL output
>
>
> Jerry Floyd wrote:
> > Now according to the above-cited web page, "You may want to
> send your output
> > directly to a printer. The Print renderer uses the java api
> to print the
> > document ..." -but I find it difficult to believe this; how
> would the print
> > renderer know which printer to direct the document to?
> That's easy: the printer in general used by the JVM, either
> set by the relevant Java property, or the default printer
> on the local machine (the usual case).
>
> > This appears to be an evocation of FOP from the command
> line. How would I
> > perform this operation from within a servlet?  Has anyone
> successfully
> > generated a PCL document and printed it on a client
> machine's printer, and
> > are any examples of their work available?  Or,
> alternatively, is there any
> > way of printing the PDF directly, without displaying it in
> a browser window
> > first?
>
> There is a somewhat longish discussion about this in the mail
> archive.
> Whether invoking Acrobat Reader from the browser for printing
> or redirecting a PCL or Postscript stream to the local (to the
> client) printer, it would involve browser specific scripting,
> something which you probably should ask about in a browser
> specific forum which discusses this topic in more detail.
>
> If you've everything on the corporate intranet, and the
> client's printer can be reached from the network from the
> server, you can try to pass the network name of the
> printer to the server, or infer it somehow from the client's
> host name or IP addr, and dig through the Java printing API
> an for a possibility to leverage it.
>
> J.Pietschmann
>
>


Re: Targeting FOP PCL output

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jerry Floyd wrote:
> Now according to the above-cited web page, "You may want to send your output
> directly to a printer. The Print renderer uses the java api to print the
> document ..." -but I find it difficult to believe this; how would the print
> renderer know which printer to direct the document to?
That's easy: the printer in general used by the JVM, either
set by the relevant Java property, or the default printer
on the local machine (the usual case).

> This appears to be an evocation of FOP from the command line. How would I
> perform this operation from within a servlet?  Has anyone successfully
> generated a PCL document and printed it on a client machine's printer, and
> are any examples of their work available?  Or, alternatively, is there any
> way of printing the PDF directly, without displaying it in a browser window
> first?

There is a somewhat longish discussion about this in the mail
archive.
Whether invoking Acrobat Reader from the browser for printing
or redirecting a PCL or Postscript stream to the local (to the
client) printer, it would involve browser specific scripting,
something which you probably should ask about in a browser
specific forum which discusses this topic in more detail.

If you've everything on the corporate intranet, and the
client's printer can be reached from the network from the
server, you can try to pass the network name of the
printer to the server, or infer it somehow from the client's
host name or IP addr, and dig through the Java printing API
an for a possibility to leverage it.

J.Pietschmann