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 Yann Bonnaillie <yb...@rhinfo.com> on 2004/12/06 15:26:55 UTC

How to preserve new line

Hello,


I generate a DOM by using Java, with values that can be long text with new line inside...
But when i apply transformation with FOP, new line contained in my texts are not preserved.
How can i do to keep them ? Should i replace them by some special code representing new line in pdf format ?

Thanks :)


Yann


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


Re: How to preserve new line

Posted by Chris Bowditch <bo...@hotmail.com>.
Yann Bonnaillie wrote:

> I generate a DOM by using Java, with values that can be long text with new line inside...
> But when i apply transformation with FOP, new line contained in my texts are not preserved.
> How can i do to keep them ? Should i replace them by some special code representing new line in pdf format ?

Hi Yann - this is a FAQ. See:

http://xml.apache.org/fop/faq.html#fo-preformat

Chris


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


RE: align=justify in preformatting content

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Yann Bonnaillie [mailto:ybonnaillie@rhinfo.com]
>

Hi,

> Yes I could, but it won't be very nice, and it would take a very long
> time to do that...

Aaahh... Blasted laziness! What do you mean exactly by 'not very nice'?
AFAICT, it would be:
a) far more 'appropriate' to enclose each paragraph in a fo:block. This
neatly complies with the spec stating that
"The fo:block formatting object is commonly used for formatting paragraphs,
..."
http://www.w3.org/TR/xsl/slice6.html#fo_block
For special cases, like blocks of code, you can always insert a nested
fo:block that overrides the alignment properties from the parent fo:block
(--should work, apart from a few nasty side-effects in quite exotic cases)
b) it can't be *that* difficult to make a slight adjustment to the module
creating the DOMs to end the node and start a new one whenever the CR-LF
char sequence is encountered

The problem would solve itself, because instead of having to worry about it,
you just let the formatter do what it was meant to do...

> I hope there is another way to solve my problem :)

I'm afraid I can't think of any solutions that are 'nice' (in terms of
XSL-FO idioms) :-)

Greetz,

Andreas


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


RE: align=justify in preformatting content

Posted by Yann Bonnaillie <yb...@rhinfo.com>.
Yes I could, but it won't be very nice, and it would take a very long
time to do that...
I hope there is another way to solve my problem :)

Thanks

Yann



> > -----Original Message-----
> > From: Yann Bonnaillie [mailto:ybonnaillie@rhinfo.com]
> >
> 
> Hi,
> 
> > Well, I succeed to keep my "new line" after fop transformation,
> > but now when I use text-align="justify" on my fo:block, last line
> > of each chapter (ie : before each new line) are expanded, what
> > looks very bad.
> 
> Hmmm... Not really sure how to solve this, but I think you could avoid this
> by terminating your DOM nodes at the newline character (or character
> sequence)... That way, you would generate a separate fo:block for each
> paragraph...?
> 
> May be a long shot, but HTH!
> 
> Greetz,
> 
> Andreas


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


RE: align=justify in preformatting content

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Yann Bonnaillie [mailto:ybonnaillie@rhinfo.com]
>

Hi,

> Well, I succeed to keep my "new line" after fop transformation,
> but now when I use text-align="justify" on my fo:block, last line
> of each chapter (ie : before each new line) are expanded, what
> looks very bad.

Hmmm... Not really sure how to solve this, but I think you could avoid this
by terminating your DOM nodes at the newline character (or character
sequence)... That way, you would generate a separate fo:block for each
paragraph...?

May be a long shot, but HTH!

Greetz,

Andreas


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


align=justify in preformatting content

Posted by Yann Bonnaillie <yb...@rhinfo.com>.
Well, I succeed to keep my "new line" after fop transformation,
but now when I use text-align="justify" on my fo:block, last line
of each chapter (ie : before each new line) are expanded, what looks very bad.
I tried to set text-align-last="start" but it doesn't seem to be good.
It's just the really last one that is aligned at start, but not the one at end of each chapter...

In my DOM, new line characters are &#xD;&#xA;
May be, it's not the good new line character ?

Help me please ;)
Sorry if i look like a noob...



Yann


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