可见 CropBox 中 iTextSharp 中的坐标

Coordinates in iTextSharp in visible CropBox

在 iTextSharp 中:

pagesize.getTop(0) 和 pagesize.Top 一样吗?和其他坐标类似 pagesize.getLeft(0) 和 pagesize.Left?

见以下代码:

PdfReader PDFReader = new PdfReader("c:\file.pdf");
iTextSharp.text.Rectangle PageSize = PDFReader.GetCropBox(1);
PageSize.Left;
PageSize.GetLeft(0);
PageSize.Top;
PageSize.GetTop(0);

查看源代码,它们本质上是相同的。 https://github.com/itext/itextsharp/blob/master/src/core/iTextSharp/text/Rectangle.cs#L451 https://github.com/itext/itextsharp/blob/master/src/core/iTextSharp/text/Rectangle.cs#L534

Is pagesize.GetTop(0) same as pagesize.Top? and similarly for other coordinates like pagesize.GetLeft(0) and pagesize.Left?

是的。

方法 GetTop(float) 允许您自动将边距值应用于边框,对于 0 的边距,您将获得原始边框。