PdfPen border width

When we set PdfGridCell border with Width 1 (or greater), that width looks wider than borders of another pdf library where 1 would be 1 pixel.

My question is what width unit is this: px or something else?

var cellBorder =  cell.Style.Borders.Left;

var newBorder = cellBorder.Clone();

newBorder  .Color = Colors.Red;

newBorder.Width = 1;

newBorder.DashStyle = Solid;

cell.Style.Borders.Left = newBorder;

Is there a formula for converting px width to your unit?


1 Reply 1 reply marked as answer

SV Surya Venkatesan Syncfusion Team February 17, 2022 06:55 PM UTC

Hi umlprog,


We are considering the border width as point( pdfGrid.Rows[1].Cells[0].Style.Borders.Bottom.Width = points). If you want to convert the pixel to points, Kindly try with the following code and let us know the result,

//Create a PDF unit converter instance.
PdfUnitConvertor converter = new PdfUnitConvertor();
//Convert to point.
floatwidth = converter.ConvertFromPixels(value, PdfGraphicsUnit.Point);

Note: We can also convert vice versa.


Regards,

Surya V


Marked as answer
Loader.
Up arrow icon