We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with table Border on resizing the PDF

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

Hi Rajeev,


Thanks for contacting support.

I have tested the scenario using Aspose.Pdf for Java 9.3.1 where I have used the same code snippet which you have shared above and I am unable to notice any issue while changing the zoom factor during PDF preview in Adobe Reader 11.0.3. However I have noticed that border thickness appears changing when reducing zoom factor from 100% to 75% or even less and it does not seem to be an issue with our API. The rendering of PDF depends upon the viewing application displaying the PDF file.

For your reference, I have also attached the resultant PDF generated over my end. We are sorry for this inconvenience.