menu

Document Processing

PdfSectionTemplate Class - C# PDF Library API Reference | Syncfusion

    Show / Hide Table of Contents

    PdfSectionTemplate Class

    Represents a page template for all the pages in the section.

    Inheritance
    System.Object
    PdfDocumentTemplate
    PdfSectionTemplate
    Inherited Members
    PdfDocumentTemplate.Bottom
    PdfDocumentTemplate.EvenBottom
    PdfDocumentTemplate.EvenLeft
    PdfDocumentTemplate.EvenRight
    PdfDocumentTemplate.EvenTop
    PdfDocumentTemplate.Left
    PdfDocumentTemplate.OddBottom
    PdfDocumentTemplate.OddLeft
    PdfDocumentTemplate.OddRight
    PdfDocumentTemplate.OddTop
    PdfDocumentTemplate.Right
    PdfDocumentTemplate.Stamps
    PdfDocumentTemplate.Top
    Namespace: Syncfusion.Pdf
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfSectionTemplate : PdfDocumentTemplate
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add the section.
    PdfSection section = document.Sections.Add();
    //Add pages to the section.
    PdfPage page = section.Pages.Add();
    //Create a header and draw the image.
    RectangleF bounds = new RectangleF(0, 0, document.Pages[0].GetClientSize().Width, 50);
    PdfSectionTemplate template = new PdfSectionTemplate();
    template.ApplyDocumentTopTemplate = true;
    //Create a page template.
    PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
    PdfImage image = new PdfBitmap(@"Input.jpg");
    //Draw the image in the header.
    header.Graphics.DrawImage(image, bounds);
    template.Top = header;
    //Add the header at the top of the section
    section.Template = template;
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add the section.
    Dim section As PdfSection = document.Sections.Add()
    'Add pages to the section.
    Dim page As PdfPage = section.Pages.Add()
    'Create a header and draw the image.
    Dim bounds As New RectangleF(0, 0, document.Pages(0).GetClientSize().Width, 50)
    Dim template As New PdfSectionTemplate()
    template.ApplyDocumentTopTemplate = True
    'Create a page template.
    Dim header As New PdfPageTemplateElement(bounds)
    Dim image As PdfImage = New PdfBitmap("Input.jpg")
    'Draw the image in the header.
    header.Graphics.DrawImage(image, bounds)
    template.Top = header
    'Add the header at the top of the section.
    section.Template = template
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)

    Constructors

    PdfSectionTemplate()

    Creates a new object.

    Declaration
    public PdfSectionTemplate()
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add the section.
    PdfSection section = document.Sections.Add();
    //Add pages to the section.
    PdfPage page = section.Pages.Add();
    //Create a header and draw the image.
    RectangleF bounds = new RectangleF(0, 0, document.Pages[0].GetClientSize().Width, 50);
    PdfSectionTemplate template = new PdfSectionTemplate();
    template.ApplyDocumentTopTemplate = true;
    //Create a page template.
    PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
    PdfImage image = new PdfBitmap(@"Input.jpg");
    //Draw the image in the header.
    header.Graphics.DrawImage(image, bounds);
    template.Top = header;
    //Add the header at the top of the section
    section.Template = template;
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add the section.
    Dim section As PdfSection = document.Sections.Add()
    'Add pages to the section.
    Dim page As PdfPage = section.Pages.Add()
    'Create a header and draw the image.
    Dim bounds As New RectangleF(0, 0, document.Pages(0).GetClientSize().Width, 50)
    Dim template As New PdfSectionTemplate()
    template.ApplyDocumentTopTemplate = True
    'Create a page template.
    Dim header As New PdfPageTemplateElement(bounds)
    Dim image As PdfImage = New PdfBitmap("Input.jpg")
    'Draw the image in the header.
    header.Graphics.DrawImage(image, bounds)
    template.Top = header
    'Add the header at the top of the section.
    section.Template = template
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfDocument
    PdfPage

    Properties

    ApplyDocumentBottomTemplate

    Gets or sets value indicating whether parent Bottom page template should be used or not.

    Declaration
    public bool ApplyDocumentBottomTemplate { get; set; }
    Property Value
    Type
    System.Boolean
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add the section.
    PdfSection section = document.Sections.Add();
    //Add pages to the section.
    PdfPage page = section.Pages.Add();
    //Create a header and draw the image.
    RectangleF bounds = new RectangleF(0, 0, document.Pages[0].GetClientSize().Width, 50);
    PdfSectionTemplate template = new PdfSectionTemplate();
    template.ApplyDocumentBottomTemplate = true;
    //Create a page template.
    PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
    PdfImage image = new PdfBitmap(@"Input.jpg");
    //Draw the image in the header.
    header.Graphics.DrawImage(image, bounds);
    template.Top = header;
    //Add the header at the top of the section
    section.Template = template;
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add the section.
    Dim section As PdfSection = document.Sections.Add()
    'Add pages to the section.
    Dim page As PdfPage = section.Pages.Add()
    'Create a header and draw the image.
    Dim bounds As New RectangleF(0, 0, document.Pages(0).GetClientSize().Width, 50)
    Dim template As New PdfSectionTemplate()
    template.ApplyDocumentBottomTemplate = True
    'Create a page template.
    Dim header As New PdfPageTemplateElement(bounds)
    Dim image As PdfImage = New PdfBitmap("Input.jpg")
    'Draw the image in the header.
    header.Graphics.DrawImage(image, bounds)
    template.Top = header
    'Add the header at the top of the section.
    section.Template = template
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfDocument
    PdfPage

    ApplyDocumentLeftTemplate

    Gets or sets value indicating whether parent Left page template should be used or not.

    Declaration
    public bool ApplyDocumentLeftTemplate { get; set; }
    Property Value
    Type
    System.Boolean
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add the section.
    PdfSection section = document.Sections.Add();
    //Add pages to the section.
    PdfPage page = section.Pages.Add();
    //Create a header and draw the image.
    RectangleF bounds = new RectangleF(0, 0, document.Pages[0].GetClientSize().Width, 50);
    PdfSectionTemplate template = new PdfSectionTemplate();
    template.ApplyDocumentLeftTemplate = true;
    //Create a page template.
    PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
    PdfImage image = new PdfBitmap(@"Input.jpg");
    //Draw the image in the header.
    header.Graphics.DrawImage(image, bounds);
    template.Top = header;
    //Add the header at the top of the section
    section.Template = template;
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add the section.
    Dim section As PdfSection = document.Sections.Add()
    'Add pages to the section.
    Dim page As PdfPage = section.Pages.Add()
    'Create a header and draw the image.
    Dim bounds As New RectangleF(0, 0, document.Pages(0).GetClientSize().Width, 50)
    Dim template As New PdfSectionTemplate()
    template.ApplyDocumentLeftTemplate = True
    'Create a page template.
    Dim header As New PdfPageTemplateElement(bounds)
    Dim image As PdfImage = New PdfBitmap("Input.jpg")
    'Draw the image in the header.
    header.Graphics.DrawImage(image, bounds)
    template.Top = header
    'Add the header at the top of the section.
    section.Template = template
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfDocument
    PdfPage

    ApplyDocumentRightTemplate

    Gets or sets value indicating whether parent Right page template should be used or not.

    Declaration
    public bool ApplyDocumentRightTemplate { get; set; }
    Property Value
    Type
    System.Boolean
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add the section.
    PdfSection section = document.Sections.Add();
    //Add pages to the section.
    PdfPage page = section.Pages.Add();
    //Create a header and draw the image.
    RectangleF bounds = new RectangleF(0, 0, document.Pages[0].GetClientSize().Width, 50);
    PdfSectionTemplate template = new PdfSectionTemplate();
    template.ApplyDocumentRightTemplate = true;
    //Create a page template.
    PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
    PdfImage image = new PdfBitmap(@"Input.jpg");
    //Draw the image in the header.
    header.Graphics.DrawImage(image, bounds);
    template.Top = header;
    //Add the header at the top of the section
    section.Template = template;
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add the section.
    Dim section As PdfSection = document.Sections.Add()
    'Add pages to the section.
    Dim page As PdfPage = section.Pages.Add()
    'Create a header and draw the image.
    Dim bounds As New RectangleF(0, 0, document.Pages(0).GetClientSize().Width, 50)
    Dim template As New PdfSectionTemplate()
    template.ApplyDocumentRightTemplate = True
    'Create a page template.
    Dim header As New PdfPageTemplateElement(bounds)
    Dim image As PdfImage = New PdfBitmap("Input.jpg")
    'Draw the image in the header.
    header.Graphics.DrawImage(image, bounds)
    template.Top = header
    'Add the header at the top of the section.
    section.Template = template
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfDocument
    PdfPage

    ApplyDocumentStamps

    Gets or sets value indicating whether the parent stamp elements should be used or not.

    Declaration
    public bool ApplyDocumentStamps { get; set; }
    Property Value
    Type
    System.Boolean
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add the section.
    PdfSection section = document.Sections.Add();
    //Add pages to the section.
    PdfPage page = section.Pages.Add();
    //Create a header and draw the image.
    RectangleF bounds = new RectangleF(0, 0, document.Pages[0].GetClientSize().Width, 50);
    PdfSectionTemplate template = new PdfSectionTemplate();
    template.ApplyDocumentStamps = true;
    //Create a page template.
    PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
    PdfImage image = new PdfBitmap(@"Input.jpg");
    //Draw the image in the header.
    header.Graphics.DrawImage(image, bounds);
    template.Top = header;
    //Add the header at the top of the section
    section.Template = template;
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add the section.
    Dim section As PdfSection = document.Sections.Add()
    'Add pages to the section.
    Dim page As PdfPage = section.Pages.Add()
    'Create a header and draw the image.
    Dim bounds As New RectangleF(0, 0, document.Pages(0).GetClientSize().Width, 50)
    Dim template As New PdfSectionTemplate()
    template.ApplyDocumentStamps = True
    'Create a page template.
    Dim header As New PdfPageTemplateElement(bounds)
    Dim image As PdfImage = New PdfBitmap("Input.jpg")
    'Draw the image in the header.
    header.Graphics.DrawImage(image, bounds)
    template.Top = header
    'Add the header at the top of the section.
    section.Template = template
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfDocument
    PdfPage

    ApplyDocumentTopTemplate

    Gets or sets value indicating whether parent Top page template should be used or not.

    Declaration
    public bool ApplyDocumentTopTemplate { get; set; }
    Property Value
    Type
    System.Boolean
    Examples
    //Create a new PDF document.
    PdfDocument document = new PdfDocument();
    //Add the section.
    PdfSection section = document.Sections.Add();
    //Add pages to the section.
    PdfPage page = section.Pages.Add();
    //Create a header and draw the image.
    RectangleF bounds = new RectangleF(0, 0, document.Pages[0].GetClientSize().Width, 50);
    PdfSectionTemplate template = new PdfSectionTemplate();
    template.ApplyDocumentTopTemplate = true;
    //Create a page template.
    PdfPageTemplateElement header = new PdfPageTemplateElement(bounds);
    PdfImage image = new PdfBitmap(@"Input.jpg");
    //Draw the image in the header.
    header.Graphics.DrawImage(image, bounds);
    template.Top = header;
    //Add the header at the top of the section
    section.Template = template;
    //Save the document.
    document.Save("Output.pdf");
    //Close the document.
    document.Close(true);
    'Create a new PDF document.
    Dim document As New PdfDocument()
    'Add the section.
    Dim section As PdfSection = document.Sections.Add()
    'Add pages to the section.
    Dim page As PdfPage = section.Pages.Add()
    'Create a header and draw the image.
    Dim bounds As New RectangleF(0, 0, document.Pages(0).GetClientSize().Width, 50)
    Dim template As New PdfSectionTemplate()
    template.ApplyDocumentTopTemplate = True
    'Create a page template.
    Dim header As New PdfPageTemplateElement(bounds)
    Dim image As PdfImage = New PdfBitmap("Input.jpg")
    'Draw the image in the header.
    header.Graphics.DrawImage(image, bounds)
    template.Top = header
    'Add the header at the top of the section.
    section.Template = template
    'Save the document.
    document.Save("Output.pdf")
    'Close the document.
    document.Close(True)
    See Also
    PdfDocument
    PdfPage

    See Also

    PdfDocument
    PdfPage
    Back to top Generated by DocFX
    OSZAR »
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved
    OSZAR »