I am using the opensource http://itextpdf.com/ , to create some pdf .
I could create a table , but width of all column are same , I need to change the width of the particular column .
PdfPTable table = new PdfPTable(6);
Phrase tablePhrse = new Phrase("Sl n0", normalFontBold);
PdfPCell c1 = new PdfPCell(tablePhrse);
c1.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(c1);
I could not find any method to set the width of the column , pls suggest some way to do achieve this ..
We can set the width of a table using the setWidthPercentage() method of the com. itextpdf. text.
iText is a Java library originally created by Bruno Lowagie which allows to create PDF, read PDF and manipulate them. The following tutorial will show how to create PDF files with iText. This tutorial assumes that you have basis Java and Eclipse knowledge.
iText is a library for creating and manipulating PDF files in Java and.NET. iText was written by Bruno Lowagie. The source code was initially distributed as open source under the Mozilla Public License or the GNU Library General Public License open source licenses. However, as of version 5.0.
This license is a commercial license. You have to pay for it. To answer your question: iText can be used for free in situations where you also distribute your software for free. As soon as you want to use iText in a closed source, proprietary environment, you have to pay for your use of iText.
Try this.
float[] columnWidths = new float[]{10f, 20f, 30f, 10f};
table.setWidths(columnWidths);
You can make use of setWidths() method.
table.setWidths(new int[]{200,50});
public void setWidths(int[] relativeWidths)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With