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

Issue with table Border on resizing the PDF

$
0
0
Hi,

I am using the below code from Aspose site and when I open the pdf file and change the size of the pdf from 100 to 125, 150% or even decrease it the cell border thickness starts changing. Is this a bug in Aspose or there is a workaround for this.

// Create Document instance
        com.aspose.pdf.Document doc = new com.aspose.pdf.Document();
        // Add page to PDF document
        doc.getPages().add();
        // Instantiate a table object
        com.aspose.pdf.Table table = new com.aspose.pdf.Table();
        // Add the table in paragraphs collection of the desired section
        doc.getPages().get_Item(1).getParagraphs().add(table);
        // Set with column widths of the table
        table.setColumnWidths("50 50 50");
        // Set default cell border using BorderInfo object
        table.setDefaultCellBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 0.1F));
        // Set table border using another customized BorderInfo object
        table.setBorder(new com.aspose.pdf.BorderInfo(com.aspose.pdf.BorderSide.All, 1F));

        // Create MarginInfo object and set its left, bottom, right and top margins
        com.aspose.pdf.MarginInfo margin = new com.aspose.pdf.MarginInfo();
        margin.setLeft(5f);
        margin.setRight(5f);
        margin.setTop(5f);
        margin.setBottom(5f);
        // Set the default cell padding to the MarginInfo object
        table.setDefaultCellPadding(margin);

        // Create rows in the table and then cells in the rows
        com.aspose.pdf.Row row1 = table.getRows().add();
        row1.getCells().add("col1");
        row1.getCells().add("col2");
        row1.getCells().add("col3");
        com.aspose.pdf.Row row2 = table.getRows().add();
        row2.getCells().add("item1");
        row2.getCells().add("item2");
        row2.getCells().add("item3");
        // Save the PDF document
        doc.save("c:/documents/testdata/TableDOM_new.pdf");

Thanks
Rajeev Mathur

Viewing all articles
Browse latest Browse all 3131