英文:
custom page size in pdfbox?
问题
在pdfbox中是否有一种方法可以设置自定义页面大小,例如6英寸x 8英寸。这是跑步者赛事胸卡的尺寸。目前似乎只有以下几种可用尺寸:
ReportPageSize pageSize = ReportPageSize.AVERY_5160;
PdfDocInfo doc = new PdfDocInfo(pageSize)
非常感谢任何见解。
英文:
In pdfbox is there a way to set a custom page size for example 6" x 8". This is the size of runner bib card. The only sizes that seem to be available are the following:
ReportPageSize pageSize = ReportPageSize.AVERY_5160;
PdfDocInfo doc = new PdfDocInfo(pageSize)
I appreciate any insights.
答案1
得分: 2
创建页面时传递一个MediaBox:
private static final float POINTS_PER_INCH = 72;
PDPage page = new PDPage(
new PDRectangle(6 * POINTS_PER_INCH, 8 * POINTS_PER_INCH));
“PdfDocInfo”不是来自PDFBox。
英文:
pass a mediabox when creating your page:
private static final float POINTS_PER_INCH = 72;
PDPage page = new PDPage(
new PDRectangle(6 * POINTS_PER_INCH, 8 * POINTS_PER_INCH));
"PdfDocInfo" is not from PDFBox.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论