Sign In  Sign Up Live-Chat

Unable to add table to pdf-document

Last post 07-12-2007, 7:28 AM by forever. 12 replies.
Sort Posts: Previous Next
  •  07-06-2007, 6:57 AM 82976

    Unable to add table to pdf-document

    Aspose.pdf for java :

    Hello,

    Is there a problem adding a table to a pdf-document ?

    I tried to add a simple table to a pdf-document, but this doesn't seem to work !?

    What am I doing wrong ?

    O_Table=Table$newTable(O_SECTION);
    Table$setColumnWidths(O_Table:"200 200"); 
    O_Rows=Table$getRows(O_Table);    
    Paragraphs$Add(O_Paragraphs:O_Table);
    O_Row=Rows$Add(O_Rows);      
    O_Cells = Row$getCells(O_Row);
    Cells$addStr(O_Cells:jstring);
    ...

    Thanks !

     

     
  •  07-06-2007, 9:54 AM 83000 in reply to 82976

    Re: Unable to add table to pdf-document

    Attachment: Present (inaccessible)

    Hi,

    Thank you for considering Aspose.

    In my test it works fine. Please find attached resultant Pdf using the following code:

    [ Java ]

    Pdf pdf = new Pdf();

    Section sec1 = pdf.getSections().add();

    Table table = new Table(sec1);

    table.setColumnWidths("200 200");

    Row row1 = new Row(table);

    table.getRows().add(row1);

    Text someText2 = new Text(sec1,"some text");

    Cell cell11 = new Cell(table,"Cell1");

    cell11.getParagraphs().add(someText2);

    row1.getCells().add(cell11);

    Text otherText = new Text(sec1,"some more text");

    Cell cell12 = new Cell(table,"Cells2");

    cell12.getParagraphs().add(otherText);

    row1.getCells().add(cell12);

    sec1.getParagraphs().add(table);

    pdf.save(new FileOutputStream(new File("D:/AsposeTest/HelloWorldExample.pdf")));


    Thanks.

    Adeel Ahmad
    Support Developer
    Aspose Changsha Team
    http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

     
  •  07-09-2007, 4:35 AM 83151 in reply to 83000

    Re: Unable to add table to pdf-document

    Hi Adeel,

    I tried this simple example on iseries, but still without any result !!!

    What am I doing wrong ??

     O_Table=Table$newTable(O_SECTION);              
     O_Rows=Table$getRows(O_Table);                  
     jString = stringtojstring('200 200');           
     Table$setColumnWidths(O_Table:jString);         
     freelocalref(jstring);                          
    O_Row = Row$newRow(O_Table); 
    Rows$AddR(O_Rows:O_Row);     
    O_Cells = Row$getCells(O_Row);
    apdfTableText('Tt');         
    apdfTableText('T2');         
    O_Row = Row$newRow(O_Table); 
    Rows$AddR(O_Rows:O_Row);     
    O_Cells = Row$getCells(O_Row);
    apdfTableText('Tx');         
    apdfTableText('T4');         
    O_Paragraphs = Section$getParagraphs(O_Section);
    Paragraphs$Add(O_Paragraphs:O_Table);           

    We are working with JDK 1.4.

    Thanks!

     
  •  07-09-2007, 7:30 AM 83163 in reply to 83151

    Re: Unable to add table to pdf-document

    Hi Adeel,

    Does this work on your system ?

    With us it doesn't ! (empty pdf !!)

    What's going wrong ?

    Example :

    import java.io.FileOutputStream;
    import java.io.IOException;
    import com.aspose.pdf.elements.*;
    import com.aspose.pdf.exception.AsposeBaseException;

    public class first_pdf {

    public static void main(String args[]) throws AsposeBaseException{

    try {

    Pdf pdf1 = new Pdf();

    Sections Secs1 = pdf1.getSections();

    Section sec1 = new Section(pdf1);

    Secs1.add(sec1);

    Table Tab1 = new Table(sec1);

    Tab1.setColumnWidths("200 400");

    Row row1 = new Row(Tab1);

    Rows myRows = Tab1.getRows();

    myRows.add(row1);

    Cells myCells = row1.getCells();

    myCells.add("Test");

    myCells.add("Test col2");

    Row row2 = new Row(Tab1);

    myRows.add(row2);

    myCells = row2.getCells();

    myCells.add("Test row21");

    myCells.add("Test row22");

    Paragraphs pars1 = sec1.getParagraphs();

    pars1.add(Tab1);

    FileOutputStream astream = new FileOutputStream("Tabelpdf.pdf");

    pdf1.save(astream);

    } catch(IOException e) {

    System.out.println(e);

    }

    }

    }

     
  •  07-09-2007, 8:29 AM 83172 in reply to 83163

    Re: Unable to add table to pdf-document

    Attachment: Present (inaccessible)

    Hi,

    Yes, this code is working on my system. It's strange that it is not working on your system. Please find attached resultant Pdf created using this code. Check your jar file references. If it still won't works, please try to make some simple PDF documents. For example write a simple Text.

    Thanks.

    Adeel Ahmad
    Support Developer
    Aspose Changsha Team
    http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

     
  •  07-09-2007, 8:40 AM 83177 in reply to 83172

    Re: Unable to add table to pdf-document

    Making as simple pdf works fine (text + pictures + headers), but adding a table doesn't work !

    Do you work with JDK 1.4 ?

     
  •  07-09-2007, 9:33 AM 83190 in reply to 83177

    Re: Unable to add table to pdf-document

    Hi,

    We have reproduced this error in version 2.2. We will try to fix it as soon as possible. Sorry for inconvenience.

    Thanks.

    Adeel Ahmad
    Support Developer
    Aspose Changsha Team
    http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html 

     
  •  07-11-2007, 1:18 AM 83519 in reply to 83190

    Re: Unable to add table to pdf-document

    Hello Adeel,

    Do you have any idea when this will be solved ?

    Thanks,
    Goddeau H.

     
  •  07-11-2007, 2:10 AM 83529 in reply to 83519

    Re: Unable to add table to pdf-document

    We are working on this issue and I hope we can fixed in one or two days.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-12-2007, 2:02 AM 83769 in reply to 83529

    Re: Unable to add table to pdf-document

    Attachment: Present (inaccessible)
    We have fixed this bug. The hotfix will be published early next week. You can try the attachment first.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-12-2007, 2:07 AM 83773 in reply to 83769

    Re: Unable to add table to pdf-document

    Ok, Thanks.

    I'll keep you informed.

     
  •  07-12-2007, 6:05 AM 83827 in reply to 83773

    Re: Unable to add table to pdf-document

    Hello,

    Thanks for the fixes !

    Setting Back-ground works fine,  Adding table is ok, but when saving a table with a picture included I get an error :
                                                                                  
    Message . . . . :   Java exception received when calling Java method.         
                                                                                  
    Cause . . . . . :   RPG procedure APDFCLOSED in program AAITMRMP1/APDFSRV     
      received Java exception "java.lang.NoClassDefFoundError:                    
      com.aspose.pdf.elements.IT_Image" when calling method "save" with signature 
      "(Ljava.io.OutputStream;)V" in class "com.aspose.pdf.elements.Pdf".
             

    I can't find this class (IT_Image) !

    What should I do ?

    Thanks,
    Goddeau H.

     
  •  07-12-2007, 7:28 AM 83843 in reply to 83827

    Re: Unable to add table to pdf-document

    I have reproduced this error and logged this issue. I hope it can be fixed soon.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
View as RSS news feed in XML