Hi,
I am trying to output large cell.
However, the first page is blank.
(Please execute to a sample program.)
Is it possible to settle this problem?
Thanks for your help.
Daisuke Yamanaka.
(((Rquired jar)))
iText-2.1.3.jar
iTextAsian.jar
(((Sample Program)))
package pdftest;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Cell;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;
public class LargeCellTest {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter.getInstance(document, new
FileOutputStream("LargeCellTest.pdf"));
document.open();
BaseFont bf = BaseFont.createFont("HeiseiKakuGo-W5",
"UniJIS-UCS2-H", BaseFont.NOT_EMBEDDED);
Font font = new Font(bf, 12);
/*
Paragraph para = new Paragraph("LargeCellTest
CellsFitPage=true
Program",font);
para.setAlignment(Element.ALIGN_CENTER);
document.add(para);
*/
Table table = new Table(1);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table.setCellsFitPage(true);
table.setPadding(0f);
table.setSpacing(0f);
for (int j=0;j<2;j++) {
Table table2 = new Table(2);
table2.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
table2.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
table2.setPadding(0f);
table2.setSpacing(0f);
for (int i=0;i<90;i++) {
StringBuffer s = new StringBuffer();
s.append("abcdefg/tuvwxyz/ABCDEFG/TUVWXYZ/");
s.append(i);
s.append("\n");
Chunk chunk = new Chunk(new String(s),
font);
chunk.setTextRise(4.0f);
Paragraph paragraph = new
Paragraph(chunk);
paragraph.setIndentationLeft(3.0f);
Cell cell2 = new Cell(paragraph);
if (i%3 == 1) {
cell2.setRowspan(2);
} else {
cell2.setRowspan(1);
}
table2.addCell(cell2);
}
Cell cell = new Cell(table2);
table.addCell(cell);
}
document.add(table);
}catch(DocumentException de) {
System.err.println(de.getMessage());
}catch(IOException ioe) {
System.err.println(ioe.getMessage());
}catch(Exception e){
System.err.println(e.getMessage());
}
document.close();
}
}
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar