Class PdfSectionTemplate
Represents a page template for all the pages in the section.
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
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
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 | Description |
---|---|
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
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 | Description |
---|---|
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
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 | Description |
---|---|
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
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 | Description |
---|---|
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
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 | Description |
---|---|
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)