FOP Dynamic Heading Size?

Devon

Usenet Archive
Joined
Jan 15, 2004
Messages
2
Reaction score
0
Hi All,
I'm generating a pdf document using FOP .25 from Apache. I've created running dynamic headings (e.g. chapter titles) that change as dictated by the XML source I'm converting to PDF. Now thats fine. My clients wish to include a variable length note as well in this page region. Trouble is I've only been able to do this by statically sizing the region to house this data. If no data (e.g. the note) exists for a given heading - just white space is shown. The clients hate it and apparently this is a show-stopping issue. A mustfix.

Is there a way to have the fo-region-before shrink / grow dynamically based on the data display within that region?
 

Brian Genisio

Usenet Archive
Joined
Dec 22, 2003
Messages
276
Reaction score
0
I know I have done this in Java, but is there a way to do it in C++?

Type B and C inherit from type A.

In a function, I want to check an instance of A (which can also be B or C), to see what it is, and move on... something like:

A something;
if( A.typeof(B) )
{
B somethingB = static_cast<B>(something);
// Do things with the B members
}
else if ( A.typeof(C) )
{
C somethingC = static_cast<C>(something);
// Do things with the C members
}
else
{
// Do things with the A members
}

I know I can accomplish something similar with virtual functions (polymorphism), but can the above be done in any way?

Just curious.
Brian
 

Michael Winter

Usenet Archive
Joined
Nov 23, 2002
Messages
3,424
Reaction score
0
On Thu, 15 Jan 2004 15:01:57 -0500, Brian Genisio
wrote:

I know I have done this in Java, but is there a way to do it in C++?

You do realise that this is a JavaScript group, don't you?

Try asking in comp.lang.c++

Mike
 

kaeli

Usenet Archive
Joined
Dec 5, 2001
Messages
2,631
Reaction score
0
In article <4006f1ec$>, enlightened
us with...
I know I have done this in Java, but is there a way to do it in C++?

AFAIK, yes.

Go ask in a C group. :)
 

Mike Partridge

Usenet Archive
Joined
Jan 13, 2004
Messages
6
Reaction score
0
The size of a static-content region can't be dynamic, but you can calc the size based on the size of your note. Ex:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/">
<fo:root>
<fo:layout-master-set>

<xsl:variable name="size" select="string-length(/xml/note/text) div 50"/>

<fo:simple-page-master master-name="report_page_master" page-height="11in" page-width="8.5in"> <fo:region-body region-name="xsl-region-body" margin=".5in" margin-top="{$size}in"/>

....

This counts the number of chars making up the note node to calc the size. You'll probaly want to figure out your own magic number instead of 50, but you'll want to use that variable in the margin-top of region-body and the extent of region-before.

Mike
 

Brian (8)

Usenet Archive
Joined
Dec 2, 2003
Messages
29
Reaction score
0
"Michael Winter" wrote:

On Thu, 15 Jan 2004 15:01:57 -0500, Brian Genisio
wrote:

> I know I have done this in Java, but is there a way to do it in C++?

You do realise that this is a JavaScript group, don't you?

Try asking in comp.lang.c++

Mike

ARGHHHHH!!!!!!!

I feel like a stooge. I actively follow two news groups... alt.lang.javascript, and alt.lang.c++. I accadently posted to the wrong group.

The reason I feel so bad, is because I always get frustrated with incorrect postings to the different groups, weather it be java questions in the javascript group, or MFC questions in the C++ group.

How about a C++ question in the javascript group?

Blah,
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,224
Members
248,132
Latest member
henrywalsh

Latest Threads

Top