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 Craig Ringer <cr...@postnewspapers.com.au> on 2010/11/29 09:44:41 UTC

Cropping output to content

Hi all

For the project I'm working on, I'm finding myself with the need to
generate previews of partial (snippet) XSL-FO content for users.

As part of that, I'm finding that I want to "rubber band" or clip the
output so that excess white space is omitted. As I don't seem to see any
way to make a page template contract to fit the content I suspect I'll
be post-processing the area tree or the final output to crop it around
the content.

I'm just wondering if there's some obvious approach I might be missing.
I'm not loving the idea of more area tree processing, though it's worked
very well for the vertical space distribution problem I had a while ago.

-- 
System & Network Administrator
POST Newspapers

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


Re: Cropping output to content

Posted by Peter Hancock <pe...@gmail.com>.
Hi Craig,

I think that post processing the area tree will be the only solution -
FOP can only fit content to page view-ports and not the reverse.  To
make life easy you could use id's to demarcate  the section you want
to preview, making the extraction easier.

Ideally you should process a whole page sequence, and not just a
snippet: The problem with processing a section of the whole document
is that the layout of that section is dependent on the whole document
Generating just a small section will potentially yield a  preview that
does not match the final layout.

Pete


On Mon, Nov 29, 2010 at 8:44 AM, Craig Ringer
<cr...@postnewspapers.com.au> wrote:
> Hi all
>
> For the project I'm working on, I'm finding myself with the need to
> generate previews of partial (snippet) XSL-FO content for users.
>
> As part of that, I'm finding that I want to "rubber band" or clip the
> output so that excess white space is omitted. As I don't seem to see any
> way to make a page template contract to fit the content I suspect I'll
> be post-processing the area tree or the final output to crop it around
> the content.
>
> I'm just wondering if there's some obvious approach I might be missing.
> I'm not loving the idea of more area tree processing, though it's worked
> very well for the vertical space distribution problem I had a while ago.
>
> --
> System & Network Administrator
> POST Newspapers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

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


Re: Cropping output to content

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Theoretically, XSL-FO supports page-height="indefinite" on
fo:simple-page-master:
http://www.w3.org/TR/xsl11/#page-height

But FOP doesn't support that, yet. In the meantime, you need to take two
steps and inspect the area tree XML in the first step as Peter suggested.
Or you post-process the area tree XML by changing the actual page height
and run the result through the AreaTreeParser:
http://xmlgraphics.apache.org/fop/1.0/intermediate.html#usage

On 29.11.2010 09:44:41 Craig Ringer wrote:
> Hi all
> 
> For the project I'm working on, I'm finding myself with the need to
> generate previews of partial (snippet) XSL-FO content for users.
> 
> As part of that, I'm finding that I want to "rubber band" or clip the
> output so that excess white space is omitted. As I don't seem to see any
> way to make a page template contract to fit the content I suspect I'll
> be post-processing the area tree or the final output to crop it around
> the content.
> 
> I'm just wondering if there's some obvious approach I might be missing.
> I'm not loving the idea of more area tree processing, though it's worked
> very well for the vertical space distribution problem I had a while ago.
> 
> -- 
> System & Network Administrator
> POST Newspapers



Jeremias Maerki


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