简体   繁体   English

如何使用 iText7 设置 pdf 文档第一页的上边距?

[英]How can I set top margin of the first page of pdf document using iText7?

I want to set top margin of my first page.我想设置第一页的上边距。 Unfortunately it doesn't work.不幸的是它不起作用。 I tried the document.SetTopMargin(100) but that sets all pages.我尝试了document.SetTopMargin(100)但它设置了所有页面。 I just want to set my first page.我只想设置我的第一页。

The margin for the next page has to be set before the page break.下一页的边距必须在分页符之前设置。

document.SetTopMargin(100);
document.Add(new Paragraph("Text on first page"));
document.SetTopMargin(0);
document.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
document.Add(new Paragraph("Text on second page"));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修改现有 PDF 中的外部链接,使其指向使用 IText7 和 C# 的文档中的内部页面? - How do I modify external link in an existing PDF such that it points to an internal page within document using IText7 and C#? 完成生成后如何将页码添加到我的 iText7 Pdf 中? - How can I add page numbers to my iText7 Pdf after im done generating it? 使用 itextsharp 或 itext7 裁剪 PDF 页面并保存为新的 PDF 文档? - Crop a piece of a PDF page and save it as a new PDF document using itextsharp or itext7? 如何使用 Itext7 C#.net 在 pdf 上创建复选框 - how can i create checkbox on pdf using Itext7 C#.net 如何使用 iText7 确定 Type 3 PDF 字体的实际字体名称? - How can I determine the actual font name of a Type 3 PDF Font using iText7? 如何通过 iText7 在 calibri 上设置我的字体? - How can I set my font on calibri via iText7? 如何在 iText7 的特定页面底部插入元素? - How can I insert an element to the bottom of a specific page in iText7? 使用 iText7 C# 解析/读取 PDF 文档 - Parsing/Reading a PDF Document using iText7 C# 如何在 C# 中使用 IText7 在现有 pdf 顶部添加条形码? - How to add a Barcode at the top of an existing pdf using IText7 in C#? 当一行太大而无法放在第一页时,如何禁用 Itext7 中 C# 的行拆分(不是表格?)? - How can I disable the splitting of rows (not tables!) in Itext7 for C# when one row is to big to fit on the first page?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM