简体   繁体   English

Docraptor PDF:如何避免在第二页显示标题

[英]Docraptor PDF: How to avoid displaying header in 2nd Page

Im generating PDFs using docraptor API and my pdfs can have multiple pages. 我使用docraptor API生成PDF,而我的pdf可以有多个页面。 I have set the header image for the pdf but it appears on all pages. 我已经为pdf设置了标题图片,但它出现在所有页面上。 I need the header in the first page only. 我只需要第一页中的标题。

TIA TIA

Lecstor's answer will definitely work in this case, but it's possible to have vary headers on different pages. 在这种情况下,Lecstor的答案肯定会起作用,但是可以在不同页面上使用不同的标题。

Full documentation is available on Prince (DocRaptor's PDF renderer) Named Pages section, but it should look roughly like this: 完整的文档可在Prince(DocRaptor的PDF渲染器)的Named Pages部分中找到,但其外观大致应如下所示:

<style type="text/css">
@page has-header {
  @top {
    content: "This is header of text";
  }
}

.first-page {
  page: has-header; 
  /* all content within .first-page will use the above @page styling */
}
</style>

<div class="first-page">
  Put first page content here
</div>

<p>Rest of content will not have a header.</p>

That pattern can be repeated. 该模式可以重复。 Different named pages can have different headers, different margins, different landscape/portrait modes, sizes, etc.. 不同的命名页面可以具有不同的标题,不同的边距,不同的风景/肖像模式,大小等。

您不仅可以将其设置为文档开头的常规内容,还不能设置为每页重复的标题吗?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM