OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

VariableBorder cell renders border differently from nonVariableBorder cell

Open StevenStreasick opened this issue 1 year ago • 0 comments

Describe the bug

useVariableBorder(true) causes a cell to render its border slightly inward compared to a nonVariableBorder counterpart (See image below)

VariableBorders

To Reproduce

This code was used to generate the image above

PdfPTable table = new PdfPTable(2);
table.setWidthPercentage(100f);
			
PdfPCell cell = new PdfPCell(new Phrase("Variable Borders"));
cell.setBorderWidth(5);
cell.setUseVariableBorders(true);
cell.setUseBorderPadding(true); //This is to prevent the text from getting squashed by the border - The issue is replicable without this line
			
PdfPCell normalCell = new PdfPCell(new Phrase("Non Variable Borders"));
normalCell.setBorderWidth(5);
normalCell.setUseBorderPadding(true);
normalCell.setUseBorderPadding(true); 
			
table.addCell(cell);
table.addCell(normalCell);
doc.add(table);

Expected behavior

I would expect both of these cell borders to be identical, as the only thing differing from these cells, aside from the text, is the isVariableBorders boolean

System

  • OS: Windows
  • Used font: Default font
  • OpenPDF version: 2.0.3

Your real name

Steven Streasick

StevenStreasick avatar Aug 15 '24 12:08 StevenStreasick