| By Date: | <-- --> |
| By Thread: | <-- --> |
Paulo Soares wrote:
That's a side effect of the font propagation that changes the Chunk.
pschema.add(new Chunk(schemaLabel));
will solve the problem.
Paulo
-----Original Message-----
From: itext-questions-admin (at) lists.sourceforge.net [mailto:itext-questions-admin (at) lists.sourceforge.net] On Behalf Of Antonio Gurisatti
Sent: Friday, May 19, 2006 5:01 PM
To: itext-questions (at) lists.sourceforge.net
Subject: Re: [iText-questions] New paragraph is appending data from previous one.
Paulo Soares wrote:
reports in anPost code that can be run standalone.
Paulo
-----Original Message-----
From: itext-questions-admin (at) lists.sourceforge.net [mailto:itext-questions-admin (at) lists.sourceforge.net] On Behalf Of Antonio Gurisatti
Sent: Friday, May 19, 2006 5:25 AM
To: iText
Subject: [iText-questions] New paragraph is appending data
from previous one.
I'm brand new using iText and I'm trying to build some
database andEclipse RCP application.
The report is very simple. It reads some records from a
previous one.prints them.
This is the source:
package com.maguri.derbypad.reports;
import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.sql.ResultSet; import java.sql.SQLException;
import com.lowagie.text.Chunk; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Font; import com.lowagie.text.PageSize; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfWriter; import com.maguri.derbypad.db.sql.NavigatorSql; import com.maguri.utilities.DateUtilities;
/** * (at) author agurisatti * */ public class ObjectInventoryReport {
Font tit1 = new Font(Font.HELVETICA, 12, Font.BOLD);
Font tit2 = new Font(Font.HELVETICA, 9, Font.BOLD);
Font tit3 = new Font(Font.HELVETICA, 7, Font.NORMAL);
Font paragraph1 = new Font(Font.HELVETICA, 8, Font.NORMAL);
protected Document document;
protected Paragraph title1;
protected Paragraph title2;
protected Paragraph title3;
protected Paragraph emptyline = new Paragraph(" ");
protected Paragraph pschema;
protected Chunk schemaLabel = new Chunk(" Schema: ", tit2);
protected Chunk schemaName;
/** * */ public ObjectInventoryReport() { initialize(); }
private void initialize() { document = new Document(); try { PdfWriter.getInstance(document, new FileOutputStream( "D:/Temporal/HelloWorld.pdf")); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (DocumentException e) { e.printStackTrace(); } document.setPageSize(PageSize.LETTER); document.addTitle("Object Inventory"); document.addSubject("The inventory of database objects"); document.addAuthor("maguriWorks"); document.addCreator("DerbyPad 1.0");
// Left, right, top, bottom in points (72 x inch) document.setMargins(72, 40, 72, 36); configureTitles(); }
private void configureTitles() {
title1 = new Paragraph("DerbyPad 1.0", tit3);
title2 = new Paragraph(
"Generated on " + DateUtilities.getCurrentDate(), tit3);
title3 = new Paragraph("Object Inventory", tit1);
}
public void generateDocument() { document.open(); printTitles(); ResultSet rs = NavigatorSql.getSchemas("%"); try { while (rs.next()) { printSchemaTitle(rs.getString(1)); } } catch (SQLException e) { e.printStackTrace(); } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } } document.close(); }
private void printTitles() { try { document.add(title1); document.add(title2); document.add(title3); } catch (DocumentException e) { e.printStackTrace(); } }
private void printSchemaTitle(String schName) { pschema = new Paragraph(); Chunk ch = new Chunk(schName, tit2); * pschema.add(schemaLabel); pschema.add(ch);* try { document.add(emptyline); document.add(pschema); } catch (DocumentException e) { e.printStackTrace(); } } }
The result is quite odd:
DerbyPad 1.0 Generated on 2006-5-18 22:34:40 Object Inventory Schema: APP Schema: APPDERBYPAD Schema: APPDERBYPADESQUEMA1 Schema: APPDERBYPADESQUEMA1ESQUEMA2 Schema: APPDERBYPADESQUEMA1ESQUEMA2ESQUEMA3 Schema: APPDERBYPADESQUEMA1ESQUEMA2ESQUEMA3LOADER_TESTS Schema: APPDERBYPADESQUEMA1ESQUEMA2ESQUEMA3LOADER_TESTSMGCOMUN
As you can see eache new schema name is appended to the
unfortunatellyThe odd thing is that if a change the order of the two statements in bold,
instead of * pschema.add(schemaLabel); pschema.add(ch);* use * pschema.add(ch);* * pschema.add(schemaLabel);
*then the result is:
DerbyPad 1.0 Generated on 2006-5-18 23:20:4 Object Inventory APP Schema: DERBYPAD Schema: ESQUEMA1 Schema: ESQUEMA2 Schema: ESQUEMA3 Schema: LOADER_TESTS Schema: MGCOMUN Schema: MGCONTABIL Schema:
I've spent quite a time trying to find the problem but
Pode conter informaÃÃo confidencial ou legalmente protegida. A incorrecta transmissÃo desta mensagem nÃo significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. Ã proibido a qualquer pessoa que nÃo o destinatÃrio de usar, revelar ou distribuir qualquer parte desta mensagem.couldn't.
So the question is WHAT AM I DOING WRONG?
Thanks a lot for any help
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
dat=121642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Aviso Legal:
Esta mensagem à destinada exclusivamente ao destinatÃrio.
receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
Disclaimer:
This message is destined exclusively to the intended
services, security?
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web
Get stuff done quickly with pre-integrated technology tomake your job easier
Download IBM WebSphere Application Server v.1.0.1 based onApache Geronimo
http://sel.as-us.falkag.net/sel?cmd=k&kid0709&bid&3057&dat1642 _______________________________________________ iText-questions mailing list iText-questions (at) lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions
I'm attaching a tiny app showing the problem.
Thanks again
Aviso Legal:
Esta mensagem à destinada exclusivamente ao destinatÃrio. Pode conter informaÃÃo confidencial ou legalmente protegida. A incorrecta transmissÃo desta mensagem nÃo significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. à proibido a qualquer pessoa que nÃo o destinatÃrio de usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
RÈï:&qï[ïïïyïhvïïïï^yïhïïiïïpyïïïzïrïï!ïïïn}ïhïêï%ïïïïÞ{^ïïïyï^rè2ïïïïìïïmæïà åHÅm*azïïïïbqïbïtïïï]5mïvïïï!xgïïxïïmïïïzVïïïÚFïïïïï\ïÐI"t Ó=n'ÛïïZï ×6ï7ïïïïïØïÉïXïïXïï$ïïÚzïbï{%ïïlïïïqïïïzïmïï?ïXïïï(ïï~ïïzwïïXïïïïïbïï?ï×ïïïïØns==
Paulo,
Yes indeed, it solved the problem
Thanks a heap.
AG
------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ iText-questions mailing list iText-questions (at) lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions