【问题标题】:How can I set top margin of the first page of pdf document using iText7?如何使用 iText7 设置 pdf 文档第一页的上边距?
【发布时间】:2020-04-14 13:03:24
【问题描述】:

我想设置第一页的上边距。不幸的是,它不起作用。我尝试了document.SetTopMargin(100),但这会设置所有页面。我只想设置我的第一页。

【问题讨论】:

    标签: c# pdf itext7


    【解决方案1】:

    下一页的边距必须在分页符之前设置。

    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"));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-09
      • 2011-04-23
      • 2020-02-06
      • 2014-08-07
      相关资源
      最近更新 更多