gpt4 book ai didi

java - 表的绝对位置用什么度量单位表示?我可以用厘米表示这个位置吗?

转载 作者:行者123 更新时间:2023-11-30 08:56:28 24 4
gpt4 key购买 nike

这是我第一次使用 iText,我对表格的绝对位置有些怀疑。

com.itextpdf.text.Document document = new com.itextpdf.text.Document(com.itextpdf.text.PageSize.A4, 0, 0, 0, 0);

try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(result));

document.open();

PdfPTable table = new PdfPTable(1);
table.setTotalWidth(100);

PdfContentByte canvas = writer.getDirectContent();
PdfPCell cell1 = new PdfPCell(new Paragraph("TEST TEST TEST TEST"));

table.completeRow();
table.writeSelectedRows(0, -1, 3, 53, canvas);
document.close();
}catch (DocumentException ex){
ex.printStackTrace();
}catch (IOException ex){
ex.printStackTrace();
}

所以我通过这一行设置了我的表格的绝对位置:

table.writeSelectedRows(0, -1, 3, 53, canvas);

表格从 X=3 和 Y=53 文档的左下角“移动”

我的疑问是:这个值是用什么计量单位表示的?像素?或者什么?

我可以用 cm(厘米)表示这些值吗?怎么办?

最佳答案

请阅读文档,例如免费电子书 The Best Questions on StackOverflow .您会发现诸如 How to get the UserUnit property from a PdfFile using iTextSharp PdfReader 之类的问题带有这样的标注:

enter image description here

这解释了 PDF(和 iText)中的度量单位。

关于如何使用 cm 的问题,您可以查阅 API 文档,您可以在其中找到诸如 millimetersToPoints 之类的方法。 .

关于java - 表的绝对位置用什么度量单位表示?我可以用厘米表示这个位置吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28582982/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com