Click here to Skip to main content
15,892,643 members

FOP - Text to XML to PDF

TorstenH. asked:

Open original thread
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?
Tags: XML, Java, PDF

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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