Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Not able to add images in a table

$
0
0
Hi ,

I am not able to add images to pdf document using the following code.The application hangs on save.
I am using aspose 4.5..Also my requirement is to span the image to next row..Please help

                           Locale locale1 = new Locale("en");

                                                Locale.setDefault(locale1);

                                                // Added document

                                                Document doc = new com.aspose.pdf.Document();

                                                doc.getPageInfo().isLandscape(true);

 

                                                Table table = new Table();

 

                                                Page curPage = doc.getPages().add();

                                                curPage.getParagraphs().add(table);

 

                                                table.setColumnWidths("50 100");

 

                                                Row row = table.getRows().add();

                                                                       

                                                Cell cell1 = row.getCells().add();

                                                cell1.getParagraphs().add(new TextFragment("Hai"));

                                               

                                                Cell cell2 = row.getCells().add();

                                                Image image = new Image();

                                                image.setImageStream(new FileInputStream("scheduler-logo.jpg"));

                                                cell2.getParagraphs().add(image);

                                                

                                               

                                                doc.save( new BufferedOutputStream(new FileOutputStream("images.pdf")));

       ByteArrayOutputStream baos = new ByteArrayOutputStream();

                            doc.save(baos, new PdfSaveOptions().getSaveFormat());


Viewing all articles
Browse latest Browse all 3131

Trending Articles