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

Free Support Forum - aspose.com

Thick Borders on PDF Table

Issue : We are using Aspose.pdf library for generating pdf reports, we are seeing thick/uneven cell borders at random places on pdf.

Library Details : aspose.pdf-19.2.jar

Sample Code:

import com.aspose.pdf.BorderInfo;
import com.aspose.pdf.BorderSide;
import com.aspose.pdf.Color;
import com.aspose.pdf.Document;
import com.aspose.pdf.MarginInfo;
import com.aspose.pdf.Row;
import com.aspose.pdf.Table;

public class ThickBorderIssue {

public static void main(String[] args) {

	Document doc = new Document();
	doc.getPages().add();
	
	doc.getPages().get_Item(1).getPageInfo().setLandscape(true);

	Table table = new Table();

	doc.getPages().get_Item(1).getParagraphs().add(table);

	table.setColumnWidths("50 50 50");

	table.setDefaultCellBorder(new BorderInfo(BorderSide.All, 0.05F));

	table.setBorder(new BorderInfo(BorderSide.All, 0.05F));

	MarginInfo margin = new MarginInfo();
	margin.setLeft(5f);
	margin.setRight(5f);
	margin.setTop(5f);
	margin.setBottom(5f);

	table.setDefaultCellPadding(margin);

	table.setRepeatingRowsCount(1);

	Row row1 = table.getRows().add();
	row1.setBackgroundColor(Color.getGreen());
	row1.getCells().add("col1");
	row1.getCells().add("col2");
	row1.getCells().add("col3");
	row1.getCells().add("col1");
	row1.getCells().add("col2");
	row1.getCells().add("col3");

	for (int i = 0; i < 100; i++) {
		Row row = table.getRows().add();
		row.getCells().add("item " + i);
		row.getCells().add("item " + i);
		row.getCells().add("item " + i);
		row.getCells().add("item " + i);
		row.getCells().add("item " + i);
		row.getCells().add("item " + i);
	}
	// Save the PDF document
	doc.save("ThickBorderIssue.pdf");
}

}

@fiserv

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFJAVA-38654 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi Farhan,

I see ticket PDFJAVA-38654 in closed status, can you please update me on status of this defect ?

@fiserv

The ticket was closed as Not A Bug as this was not a bug of Aspose Pdf library, but a “feature” of Acrobat that shows some thin lines (hairlines) thicker than they are in fact.

Acrobat frequently displays lines of the same weight at varying widths. You may have a table with uniform rules, or an illustration with objects created with identical thin lines, but when displayed in Acrobat, some of the identical lines will look thicker. Zoom in or out, and what ever was thin may now appear thicker and vice versa.