Since itext doesn't support chunks at the document level,
the line 354 in the method handleStartingTags(..) of
* $Id: SAXiTextHandler.java,v 1.42 2002/08/23 10:45:34 blowagie Exp $
document.add(Chunk.NEWLINE);
should be changed to
current = new Paragraph(Chunk.NEWLINE);
stack.push(current);
which doesn't work either.
Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE itext SYSTEM "./itext.dtd" >
<itext>
<newline/>
<newline/>
<newline/>
<newline/>
<newline/>
<newline/>
<newline/>
<paragraph leading="30" size="20">Title - Page</paragraph>
<chapter>
<title>chapter</title>
<sectioncontent>res est arduissima, vincere
naturam</sectioncontent>
</chapter>
</itext>
By the way, there is another problem, if you combine Chunks and Chapters;
the chunks are wrapped into a Paragraph, and so it works, but the order is
changed.
Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE itext SYSTEM "./itext.dtd" >
<itext>ߐ
<newline/>
<newline/>
<newline/>
<newline/>
<newline/>
<newline/>
<newline/>
<paragraph leading="30" size="20">Title - Page</paragraph>
<chapter>
<title>chapter 1</title>
<sectioncontent>res est arduissima, vincere
naturam</sectioncontent>
</chapter>
Haec verba in finem saltant.
<chapter>
<title>chapter 2</title>
<sectioncontent>in aspectu virginis mentem esse
puram</sectioncontent>
</chapter>
</itext>
So the lines 683 - 686 in the method handleEndingTags(..) of
* $Id: SAXiTextHandler.java,v 1.42 2002/08/23 10:45:34 blowagie Exp $
if (Chapter.isTag(name)) {
document.add((Element) stack.pop());
return;
}
should be changed to
if (Chapter.isTag(name)) {
Chapter chapter = (Chapter) stack.pop();
try {
while (true) {
Element element = (Element)
stack.pop();
try {
TextElementArray previous =
(TextElementArray) stack.pop();
previous.add(element);
stack.push(previous);
}
catch(EmptyStackException es) {
document.add(element);
}
}
}
catch(EmptyStackException ese) {
// empty on purpose
}
document.add(chapter);
return;
}
Maybe the better and easier way is to delete
chunk and newline from the element list of itext
in line 60 of
$Id: itext.dtd,v 1.12 2003/09/06 09:37:52 blowagie Exp $
With best regards
Klaus Fleischer
IZB SOFT - S52
* 0911/3269-344
* IZB SOFT - S�dwestpark 108 , 90449 N�rnberg
* [EMAIL PROTECTED]
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions