Table of Contents

Class PdfSectionTemplate

Namespace
Syncfusion.Pdf
Assembly
Syncfusion.Pdf.Portable.dll

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

public class PdfSectionTemplate : PdfDocumentTemplate
Inheritance
PdfSectionTemplate
Inherited Members

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.

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

Properties

ApplyDocumentBottomTemplate

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

public bool ApplyDocumentBottomTemplate { get; set; }

Property Value

bool

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

ApplyDocumentLeftTemplate

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

public bool ApplyDocumentLeftTemplate { get; set; }

Property Value

bool

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

ApplyDocumentRightTemplate

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

public bool ApplyDocumentRightTemplate { get; set; }

Property Value

bool

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

ApplyDocumentStamps

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

public bool ApplyDocumentStamps { get; set; }

Property Value

bool

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

ApplyDocumentTopTemplate

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

public bool ApplyDocumentTopTemplate { get; set; }

Property Value

bool

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

See Also