Background Color:
 
Background Pattern:
Reset
Search
Home Recent Changes Show All Pages

Pages and Sections

3

All the visible content in a pdf document sit on pages. 
All the visble components in a pdfx file sit in Pages or Sections.
By default a page is just that, a single page of content that will be generated in the PDF output. A Section can by default extend beyond a single page and content will continue to flow onto more and more generated PDF Pages.
Explicit page breaks can be put in to the content to force a section to go on to the next page.

<Pages>

    <pdf:Page id="FirstPage" >
      <Content>My First Page</Content>
    </pdf:Page>

    <pdf:Section id="FirstSection" >
      <Content>
        The first page of the section
        <pdf:PageBreak/>
        The second page of the content
      </Content>
    </pdf:Section>
    
    <pdf:Page-Ref id="FirstPage” source="./Pages/TermsAndConditions.ppfx" >

  </Pages>

A Page

The Page definition contains the standard component attributes for id, name, visible, outline-title, along with the styles attribute. All these attributes are optional and are covered in the Component Basics and Understanding Styles articles. These articles also cover the Style and Outline child elements.
Finally the 3 main child elements are the Header, Content and Footer. Each can contain a collection of components including panels, text blocks, links etc.

For example the page below can be generated....

    <pdf:Page id="FirstPage" name="UniqueName" 
              outline-title="Outline" visible="true" 
              styles:class="page single-page" >
      <Style>
        <styles:Background color="black"/>
        <styles:Fill color="#CCCCFF"/>
        <styles:Position v-align="Middle"/>
      </Style>
      <Outline title="Overides the Outline on the element" styles:open="true" />
      <Header>
        This is some content at the head of the page
      </Header>
      <Content>
        This is some content in the middle of the page
      </Content>
      <Footer>
        This is some content at the bottom of the page
      </Footer>
    </pdf:Page>

And will result in the output shown.

The Header and Footer containers are different to the Content container in one significant feature.
They are template containers rather than actual component containers. This means that the compontents declared do not actually exist in memory until the page is laid out as part of the output process. There is a very good reason for this which will be explained when we go on to discuss Sections.

A Section

A section by default allows content to flow onto one or more generated PDF pages in the final document.

In the code the class Scryber.Components.PDFSection inherits from the class Scryber.Components.PDFPage. This means that a section acts almost exactly the same as a page. The PDFSection has a default value for overflow action of NewPage, which will allow content to flow onto any number of following output pages, and also 2 optional extra properties - ContinuationHeader and ContinuationFooter. If either is defined it will replace any existing header or footer template when the second page is laid out, or any further pages

The inheritance also means that any styles applied to the page type will also be applied to the section, but new styles applied to a section will not be applied to a page.

 

    <pdf:Section styles:class="page document">
      <Style>
        <styles:Background color="black"/>
        <styles:Fill color="#CCCCFF"/>
        <styles:Position v-align="Middle"/>
      </Style>
      <Header>
        This is the Header
      </Header>
      <Continuation-Header>
        This is the Continuation Header
      </Continuation-Header>
      <Content>
        First Page
        <pdf:PageBreak/>
        Second Page
        <pdf:PageBreak/>
        Third Page
      </Content>
      <Footer>
        This is the footer
      </Footer>
      <Continuation-Footer>
        This is the Continuation Footer
      </Continuation-Footer>
    </pdf:Section>

 

If the section is generated for the declaration above, then we will get the following output

 

 

As we can see. The continuation headers are generated for both the second and third pages.
If the section did not have a continuation footer declared then the standard footer would have been generated for all pages
This is also why the Header and Footer are templates rather than actual instances - because they can appear more than once, so must be templates that are generated each time for all the pages they appear on.

 

See Also

Page header and footer margins



  Rating
Rate This Page: Poor Great   |  Rate Content |
Average rating:  3   
00100
12345
Number of Ratings : 1
  Comments
Add Comment
No Comments Yet