LibrePDF / OpenPDF

OpenPDF is a free Java library for creating and editing PDF files, with a LGPL and MPL open source license. OpenPDF is based on a fork of iText. We welcome contributions from other developers. Please feel free to submit pull-requests and bugreports to this GitHub repository.
Other
3.6k stars 596 forks source link

VariableBorder cell renders border differently from nonVariableBorder cell #1207

Open StevenStreasick opened 3 months ago

StevenStreasick commented 3 months ago

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

Your real name

Steven Streasick