I found the problem. Thanks..
The problem was following piece of code..I was not honouring the table cell
rule.
                                c1.setColspan(4);
                table1.addCell(c1);



vislavti wrote:
> 
> Hi All,
> I am using below code and I am not able to open the generated PDF File.
> Can anyone tell me what is wrong?
> 
> import java.io.FileNotFoundException;
> import java.io.FileOutputStream;
> 
> import com.lowagie.text.Cell;
> import com.lowagie.text.Document;
> import com.lowagie.text.DocumentException;
> import com.lowagie.text.PageSize;
> import com.lowagie.text.Table;
> import com.lowagie.text.pdf.PdfWriter;
> 
> /*
>  * Created on Oct 12, 2006
>  *
>  * TODO To change the template for this generated file go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> 
> /**
>  * @author vislavti
>  *
>  * TODO To change the template for this generated type comment go to
>  * Window - Preferences - Java - Code Style - Code Templates
>  */
> public class VerticalText {
> 
>       public static void main(String[] args) throws DocumentException {
>               System.out.println("Table in cells");
>         // step1
>         Document document = new Document(PageSize.A4, 50, 50, 50, 50);
>         
>             try {
>                               // step2
>                               PdfWriter writer = 
> PdfWriter.getInstance(document, new
> FileOutputStream("c:\\TableInCell.pdf"));
>                       } catch (FileNotFoundException e) {
>                               // TODO Auto-generated catch block
>                               e.printStackTrace();
>                       } catch (DocumentException e) {
>                               // TODO Auto-generated catch block
>                               e.printStackTrace();
>                       }
>             // step3
>             document.open();
>               Table table1 = new Table(4);
>               Cell c1 = new Cell("1");
>               Cell c2= new Cell("2");
>               Cell c3= new Cell("3");
>               c3.setColspan(2);
>               Cell c4 = new Cell("4");
>               Cell c5= new Cell("5");
>               Cell c6= new Cell("6");
>               Table table2=new Table(3);
>               table1.addCell(c1);
>               table1.addCell(c2);
>               table1.addCell(c3);
>               c1.setColspan(4);
>               table1.addCell(c1);
>               //table1.addCell(c2);
>               //table1.addCell(c3);
>               table2.addCell(c4);
>               table2.addCell(c5);
>               table2.addCell(c6);
>               Cell c7= new Cell(table2);
>               c7.setColspan(4);
>               table1.addCell(c7);
>               document.add(table1);
>               document.close();
>       }
> }
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can%27t-open-pdf-file-tf2434098.html#a6787470
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to