Click here to Skip to main content
15,891,745 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey!

Does anyone know how to get formatted text via FOP into the PDF? I'm trying to find a bug and have not much of a clue about FOP.

I have a dummy text out of multiple paragraphs like:
Li Europan lingues es membres del sam familie.

Lor separat existentie es un myth.

Por scientie, musica, sport etc, litot Europa usa li sam vocabular.

Li lingues differe solmen in li grammatica, li pronunciation e li plu commun vocabules.

Omnicos directe al desirabilite de un nov lingua franca: On refusa continuar payar custosi traductores.

and my output looks like:
Li Europan lingues es membres del sam
familie.    Lor separat existentie es un myth.    Por scientie, musica, sport etc,
litot Europa usa li sam vocabular.    Li lingues differe solmen in li grammatica, li
pronunciation e li plu commun vocabules.    Omnicos directe al desirabilite de un nov
lingua franca: On refusa continuar payar custosi traductores.    At solmen va esser necessi
far uniform grammatica, pronunciation e plu sommun paroles.    Ma quande lingues coalesce,
li grammatica del resultant lingue es plu simplic e regulari quam ti del coalescent
lingues.    Li nov lingua franca va esser plu simplic e regulari quam li existent Europan
lingues.    It va esser tam simplic quam Occidental in fact, it va esser Occidental.    A
un Angleso it va semblar


You can see clearly that the linke breaks are missing.

my XSLT looks like this:
HTML
<xsl:template name="Body">
	<fo:flow flow-name="xsl-region-body">
	<fo:block 
		xsl:use-attribute-sets="body-font" 
		margin-left="2pt" 
		margin-right="2pt"
	>
		<fo:block font-size="80%" white-space-collapse="false">
			<xsl:value-of select="text" /> 
		</fo:block>
	</fo:block>
		<fo:block id="endofdoc" />
	</fo:flow>
</xsl:template>


Why don't I get the line breaks? do I have to modify the text first(HTML style) to get the paragraphs?
Posted

Post your question at the FOP mailing list:
http://xmlgraphics.apache.org/fop/maillist.html[^]

You're more likely to get a good reply there.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
TorstenH. 26-Jan-12 9:30am    
That is a mighty strange resource - that I have already tried to search on. Seems like I'm the only one who is missing his line breaks (or the only one who has a longer text to print).
Espen Harlinn 26-Jan-12 9:34am    
Try opening your output in http://www.scintilla.org/SciTE.html
It might be that the output file only contains \n and not \r\n at the end of the lines.

TorstenH. 26-Jan-12 9:42am    
hmm, there is a "\r\n\r\n" sequence between the paragraphs. I already tried to convert it by String operations - like making it "<fo:block>" and so on - but then I just get those tags in the output.
Seems to me like I'm missing some setting. How about HTML tags? would those help?
Espen Harlinn 26-Jan-12 9:45am    
I'm no expert on FOP - used it once several years ago, and found the mailing list helpful - the questions I had at that time was already answered on the list.
XML
<fo:block font-size="80%" linefeed-treatment="preserve">
   <xsl:value-of select="text" />
</fo:block>


the linefeed-treatment="preserve" does the trick.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900