You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by IvanLatysh <iv...@yourmail.com> on 2003/03/21 18:23:43 UTC

Embedding Printer Control parameters

Hi all.

We are using this kind of transformation:
XSL+XML = PS
It works fine with no problem.

And I need to embedd PCL command for duplex on PostScript printer.
How can I do it ?


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Embedding Printer Control parameters

Posted by IvanLatysh <iv...@yourmail.com>.
Hello, Jeremias!
You wrote to <fo...@xml.apache.org> on Fri, 21 Mar 2003 21:30:34 +0100:

 JM> Immediately, if you download from CVS. Seriously, a release is still
 JM> some time away. We don't know when that will be. Depends on the help
 JM> we get and how much time we have to work on FOP. Maybe you should
 JM> have a look at the redesign and see what it can already do.
I will have a look.

For now, I changed PSRenderer and add method writeFeatures(), which simply write my futures.
It does fine with duplex.

 JM> Ah yes, this is bad. But I meant setRenderer(Renderer), not 
 JM> setRenderer(String). So instantiate your sublassed renderer yourself
 JM> and pass it to FOP. It will be assigned a logger.
This is a single method which have it :-)
We are using a custom FOPEmmiter for Saxon.
And emitter do not instantiate the Renderer, it simply reading a renderer class from XSL and pass it to the Driver.
For us, this is a best way to perform a transformation.

And thank you again for your help.
---
Yours sincerely, Ivan Latysh.
Ivan[a]yourmail.com



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Embedding Printer Control parameters

Posted by Jeremias Maerki <de...@greenmail.ch>.
On 21.03.2003 21:21:46 IvanLatysh wrote:
> Hello, Jeremias!
> You wrote to <fo...@xml.apache.org> on Fri, 21 Mar 2003 20:14:59 +0100:
> 
>  JM> In the redesign that should be relatively simple. Can't say offhand
>  JM> how difficult this would be in the old FOP. The way to go is to
>  JM> implement an extension. See the website and mailing list archives
>  JM> for more information.
> When the new FOP could be available ? :-)

Immediately, if you download from CVS. Seriously, a release is still
some time away. We don't know when that will be. Depends on the help we
get and how much time we have to work on FOP. Maybe you should have a
look at the redesign and see what it can already do.

>  >> And by the way,
>  >> Almost all renderer have a bug.
>  >> Logger is not setting when renderer is creting.
> 
>  JM> The code says something else. The Driver.setRenderer() method sets
>  JM> the logger. Maybe you didn't set the logger on the Driver before
>  JM> calling setRenderer.
> fop-0.20.5rc2 - Driver.java,v 1.36.2.9 2002/12/09 00:34:56
> 
> Method
> public void setRenderer(String rendererClassName)
>         try {
>             _renderer =
>                 (Renderer)Class.forName(rendererClassName).newInstance();
>             _renderer.setProducer(Version.getVersion());
>         } catch (ClassNotFoundException e) {
> ...

Ah yes, this is bad. But I meant setRenderer(Renderer), not 
setRenderer(String). So instantiate your sublassed renderer yourself and
pass it to FOP. It will be assigned a logger.

> Method
>     public void setRenderer(int renderer) throws IllegalArgumentException {
> 
>         switch (renderer) {
>         case RENDER_PS:
>             setRenderer(new org.apache.fop.render.ps.PSRenderer());
>             break;
> ...
> 
> I am reusing the Driver. I did set the Logger before I set the renderer.

You're doing everything right.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Embedding Printer Control parameters

Posted by IvanLatysh <iv...@yourmail.com>.
Hello, Jeremias!
You wrote to <fo...@xml.apache.org> on Fri, 21 Mar 2003 20:14:59 +0100:

 JM> In the redesign that should be relatively simple. Can't say offhand
 JM> how difficult this would be in the old FOP. The way to go is to
 JM> implement an extension. See the website and mailing list archives
 JM> for more information.
When the new FOP could be available ? :-)

 >> And by the way,
 >> Almost all renderer have a bug.
 >> Logger is not setting when renderer is creting.

 JM> The code says something else. The Driver.setRenderer() method sets
 JM> the logger. Maybe you didn't set the logger on the Driver before
 JM> calling setRenderer.
fop-0.20.5rc2 - Driver.java,v 1.36.2.9 2002/12/09 00:34:56

Method
public void setRenderer(String rendererClassName)
        try {
            _renderer =
                (Renderer)Class.forName(rendererClassName).newInstance();
            _renderer.setProducer(Version.getVersion());
        } catch (ClassNotFoundException e) {
...

Method
    public void setRenderer(int renderer) throws IllegalArgumentException {

        switch (renderer) {
        case RENDER_PS:
            setRenderer(new org.apache.fop.render.ps.PSRenderer());
            break;
...

I am reusing the Driver. I did set the Logger before I set the renderer.

---
Yours sincerely, Ivan Latysh.
Ivan[a]yourmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Embedding Printer Control parameters

Posted by Jeremias Maerki <de...@greenmail.ch>.
On 21.03.2003 19:06:54 IvanLatysh wrote:
> Is there are somehow possible to embedd PS command in XSL file, and this command will be included in resulting PS file.
> This approach will be very useful.

In the redesign that should be relatively simple. Can't say offhand how
difficult this would be in the old FOP. The way to go is to implement an
extension. See the website and mailing list archives for more
information.

> And by the way,
> Almost all renderer have a bug.
> Logger is not setting when renderer is creting.

The code says something else. The Driver.setRenderer() method sets the
logger. Maybe you didn't set the logger on the Driver before calling
setRenderer.

> I would suggest to change setRenderer methods in Driver and set the logger for renderer.
> Or each renderer should set the default logger, as it doing PDFRenderer.
> If you run a transformation and do not set a logger for Renderer NullPointerException thrown in the method: 
> public void startRenderer(OutputStream outputStream)
> ...
> log.debug("rendering areas to PostScript"); // here


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Embedding Printer Control parameters

Posted by IvanLatysh <iv...@yourmail.com>.
Hello, Jeremias!
You wrote to <fo...@xml.apache.org> on Fri, 21 Mar 2003 18:38:15 +0100:

 JM> Two possibilities:
 JM> - Subclass the PostScript renderer and try to find the right place
 JM> for   your special commands. You can then set the subclassed
 JM> renderer in the
 JM>   Driver using setRenderer(Renderer).
 JM> - Post-process the generated file. If it's just a few leading and  
 JM> trailing comments, this is extremely easy. Open a new
 JM> FileOutputStream,   create a Writer on that stream, send your
 JM> leading commands, pipe the   whole PS file through to the
 JM> OutputStream, then add trailing commands   via the Writer and close
 JM> the OutputStream.

 JM> I hope that helps.

Thank you for fast response.
Is there are somehow possible to embedd PS command in XSL file, and this command will be included in resulting PS file.
This approach will be very useful.

And by the way,
Almost all renderer have a bug.
Logger is not setting when renderer is creting.

I would suggest to change setRenderer methods in Driver and set the logger for renderer.
Or each renderer should set the default logger, as it doing PDFRenderer.
If you run a transformation and do not set a logger for Renderer NullPointerException thrown in the method: 
public void startRenderer(OutputStream outputStream)
...
log.debug("rendering areas to PostScript"); // here

---
Yours sincerely, Ivan Latysh.
Ivan[a]yourmail.com


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Embedding Printer Control parameters

Posted by Jeremias Maerki <de...@greenmail.ch>.
Two possibilities:
- Subclass the PostScript renderer and try to find the right place for
  your special commands. You can then set the subclassed renderer in the
  Driver using setRenderer(Renderer).
- Post-process the generated file. If it's just a few leading and
  trailing comments, this is extremely easy. Open a new FileOutputStream,
  create a Writer on that stream, send your leading commands, pipe the
  whole PS file through to the OutputStream, then add trailing commands
  via the Writer and close the OutputStream.

I hope that helps.

On 21.03.2003 18:23:43 IvanLatysh wrote:
> We are using this kind of transformation:
> XSL+XML = PS
> It works fine with no problem.
> 
> And I need to embedd PCL command for duplex on PostScript printer.
> How can I do it ?


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org