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 Ken Sands <ke...@yahoo.com> on 2006/02/08 16:52:05 UTC

Setting duplex for postscript output

I want to output using the postscript renderer in duplex, I was wondering if
there is a renderer setting for the config file or somthing to achieve this?

I've looked at the ps output and it's very easy to make it duplex, (I added the
"/Duplex true" by hand into the first setpagedevice and then removed the second
setpagedevice) but cant find a way to make fop output the ps like this.

if it's not currently possible can someone point me in the direction of the code
for postscript output so I can add it?

Ken.




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Setting duplex for postscript output

Posted by Ken Sands <ke...@yahoo.com>.
> 
> I too have experienced this problem on the PS Printers I have tested. A 
> couple of years ago I reported a similar thing to RenderX and they made 
> a change to only insert the setpagedevice dictionary onto a page if 
> there was a change from the previous page. I believe something similar 
> should be implemented in FOP.
> 
> <snip/>
> 
> Chris
> 

Exactly, I'll do it if no one else has in a couple of months, for now my one is
working for what I need, and I'm too busy to put in the time.

Ken





---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Setting duplex for postscript output

Posted by Chris Bowditch <bo...@hotmail.com>.
Ken Sands wrote:

<snip/>

> Sorry about that, I'm using 0.91.
> 
> Althought your ps-setup-code solution adds to the output postscript it still
> won't work, the reason being that each page still has a "setpagedevice" command. 
> This seems to make the printer (or at least the
> xerox 2425 I'm workin with) start a new page. Although it runs in duplex mode
> (the duplexing unit is flipping pages as it prints) it's not actually putting
> anything on the back, if I remove all but the first setpagedevice instruction
> then it works fine.

I too have experienced this problem on the PS Printers I have tested. A 
couple of years ago I reported a similar thing to RenderX and they made 
a change to only insert the setpagedevice dictionary onto a page if 
there was a change from the previous page. I believe something similar 
should be implemented in FOP.

<snip/>

Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Setting duplex for postscript output

Posted by Ken Sands <ke...@yahoo.com>.
Jeremias Maerki <dev <at> jeremias-maerki.ch> writes:

> 
> Please, please, people, always state the FOP version you're working with.
> Sigh.
> 
> Anyway, if you're working with FOP 0.20.5 you'll have to modify the FOP
> source code or post-process the PostScript file.
> 
> If you're working with FOP 0.91beta or later you can use a special
> extension:
> 
>   <fo:declarations>
>    <ps:ps-setup-code name="duplex"
xmlns:ps="http://xmlgraphics.apache.org/fop/postscript">
> <<
> /Duplex true
> >> setpagedevice
>     </ps:ps-setup-code>
>   </fo:declarations>
> 
> (the fo:declaractions element is to be placed between the
> layout-master-set and the first page-sequence.)
> 
> The documentation for this hasn't made it on the FOP website, yet.
> You'll find the specification on the Wiki:
> http://wiki.apache.org/xmlgraphics-fop/ExtensionsForPostScript
> 


Sorry about that, I'm using 0.91.

Althought your ps-setup-code solution adds to the output postscript it still
won't work, the reason being that each page still has a "setpagedevice" command. 
This seems to make the printer (or at least the
xerox 2425 I'm workin with) start a new page. Although it runs in duplex mode
(the duplexing unit is flipping pages as it prints) it's not actually putting
anything on the back, if I remove all but the first setpagedevice instruction
then it works fine.

It would seem that the setpagedevice ps code should only be added if and when
the format of a page has changed, since I'm in a hellishly busy time at work at
the moment I really can't spend time making an elegant solution to submit back
into the code base. However for my own use I'm simply going to move the section
in the fop postscript renderer that adds the setpagedevice section out of the
every page loop and into the one time only document setup section.

this is good enough for me at the moment, of course it would stop any paper
format changes mid stream, so should not be submitted to fop. Perhaps when this
busy period (2 months) is over I will take a better look at it and submit some
code that deals with it better (assuming it's not been done already by then).

Thanks for the quick reply.

Ken.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Setting duplex for postscript output

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Please, please, people, always state the FOP version you're working with.
Sigh.

Anyway, if you're working with FOP 0.20.5 you'll have to modify the FOP
source code or post-process the PostScript file.

If you're working with FOP 0.91beta or later you can use a special
extension:

  <fo:declarations>
   <ps:ps-setup-code name="duplex" xmlns:ps="http://xmlgraphics.apache.org/fop/postscript">
&lt;&lt;
/Duplex true
&gt;&gt; setpagedevice
    </ps:ps-setup-code>
  </fo:declarations>

(the fo:declaractions element is to be placed between the
layout-master-set and the first page-sequence.)

The documentation for this hasn't made it on the FOP website, yet.
You'll find the specification on the Wiki:
http://wiki.apache.org/xmlgraphics-fop/ExtensionsForPostScript

Obviously, the above solution means that you have to place the setting
in the stylesheet. If you want to control this from Java code, there are
several options:

1. Construct a PSSetupCode object and put it in a
OffDocumentExtensionAttachment object which you can pass to the
PSRenderer after manually instantiating it by calling
handleOffDocumentItem(). You will then have to set your renderer
instance on the FOUserAgent using setOverridingRenderer(). Otherwise,
your manually built instance won't be used.

2. Subclass PSRenderer and add the necessary code.

3. Change the current PSRenderer. You can send us a patch and we can add
the duplex feature to the current PSRenderer.

4. De luxe version: Extend the PSRenderer to support PPDs. :-)

Have fun!

On 08.02.2006 16:52:05 Ken Sands wrote:
> I want to output using the postscript renderer in duplex, I was wondering if
> there is a renderer setting for the config file or somthing to achieve this?
> 
> I've looked at the ps output and it's very easy to make it duplex, (I added the
> "/Duplex true" by hand into the first setpagedevice and then removed the second
> setpagedevice) but cant find a way to make fop output the ps like this.
> 
> if it's not currently possible can someone point me in the direction of the code
> for postscript output so I can add it?
> 
> Ken.


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org