Table of Contents

Class PdfPageTemplateCollection

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

Implements a collection of page template in the document.

public class PdfPageTemplateCollection : IEnumerable
Inheritance
PdfPageTemplateCollection
Implements
Inherited Members

Properties

Count

Gets number of the elements in the collection.

public int Count { get; }

Property Value

int

Examples

//Loads an existing PDF Document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Total number of elements in the collection
int count = loadedDocument.PdfPageTemplates.Count;
//Gets the PdfPageTemplate at the specified index.
PdfPageTemplate pageTemplate = loadedDocument.PdfPageTemplates[0];
//Determines whether the specified PdfPageTemplate presents in the collection
bool contains = loadedDocument.PdfPageTemplates.Contains(pageTemplate);
//Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate);
//Remove the specified PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.RemoveAt(1);
//Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear();
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close(true);
'Loads an existing PDF Document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Total number of elements in the collection
Dim count As Integer = loadedDocument.PdfPageTemplates.Count
'Gets the PdfPageTemplate at the specified index.
Dim pageTemplate As PdfPageTemplate = loadedDocument.PdfPageTemplates(0)
'Determines whether the specified PdfPageTemplate presents in the collection
Dim contains As Boolean = loadedDocument.PdfPageTemplates.Contains(pageTemplate)
'Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.RemoveAt(1)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear()
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close(True)

this[int]

Gets the PdfPageTemplate at the specified index.

public PdfPageTemplate this[int index] { get; }

Parameters

index int

Property Value

PdfPageTemplate

Examples

//Loads an existing PDF Document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Total number of elements in the collection
int count = loadedDocument.PdfPageTemplates.Count;
//Gets the PdfPageTemplate at the specified index.
PdfPageTemplate pageTemplate = loadedDocument.PdfPageTemplates[0];
//Determines whether the specified PdfPageTemplate presents in the collection
bool contains = loadedDocument.PdfPageTemplates.Contains(pageTemplate);
//Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate);
//Remove the specified PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.RemoveAt(1);
//Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear();
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close(true);
'Loads an existing PDF Document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Total number of elements in the collection
Dim count As Integer = loadedDocument.PdfPageTemplates.Count
'Gets the PdfPageTemplate at the specified index.
Dim pageTemplate As PdfPageTemplate = loadedDocument.PdfPageTemplates(0)
'Determines whether the specified PdfPageTemplate presents in the collection
Dim contains As Boolean = loadedDocument.PdfPageTemplates.Contains(pageTemplate)
'Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.RemoveAt(1)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear()
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close(True)

Methods

Add(PdfPageTemplate)

Creates and adds a PdfPageTemplate

public void Add(PdfPageTemplate pdfPageTemplate)

Parameters

pdfPageTemplate PdfPageTemplate

Examples

// Loads an existing PDF Document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Get the first page of the document
PdfPageBase page = loadedDocument.Pages[0];
//Create a page template
PdfPageTemplate pageTemplate = new PdfPageTemplate(page);
//Sets the PdfPageTemplate name
pageTemplate.Name = "pageTemplate";
//Sets the PdfPageTemplate is visible
pageTemplate.IsVisible = true;
//Adds the page template
loadedDocument.PdfPageTemplates.Add(pageTemplate);
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close(true);
'Loads an existing PDF Document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get the first page of the document
Dim page As PdfPageBase = loadedDocument.Pages(0)
'Create a page template
Dim pageTemplate As PdfPageTemplate = New PdfPageTemplate(page)
'Sets the PdfPageTemplate name
pageTemplate.Name = "pageTemplate"
'Sets the PdfPageTemplate is visible
pageTemplate.IsVisible = True
'Adds the page template
loadedDocument.PdfPageTemplates.Add(pageTemplate)
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close(True)

Clear()

Removes all the PdfPageTemplate from the collection.

public void Clear()

Examples

//Loads an existing PDF Document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Total number of elements in the collection
int count = loadedDocument.PdfPageTemplates.Count;
//Gets the PdfPageTemplate at the specified index.
PdfPageTemplate pageTemplate = loadedDocument.PdfPageTemplates[0];
//Determines whether the specified PdfPageTemplate presents in the collection
bool contains = loadedDocument.PdfPageTemplates.Contains(pageTemplate);
//Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate);
//Remove the specified PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.RemoveAt(1);
//Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear();
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close(true);
'Loads an existing PDF Document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Total number of elements in the collection
Dim count As Integer = loadedDocument.PdfPageTemplates.Count
'Gets the PdfPageTemplate at the specified index.
Dim pageTemplate As PdfPageTemplate = loadedDocument.PdfPageTemplates(0)
'Determines whether the specified PdfPageTemplate presents in the collection
Dim contains As Boolean = loadedDocument.PdfPageTemplates.Contains(pageTemplate)
'Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.RemoveAt(1)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear()
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close(True)

Contains(PdfPageTemplate)

Determines whether the specified PdfPageTemplate presents in the collection.

public bool Contains(PdfPageTemplate pdfPageTemplate)

Parameters

pdfPageTemplate PdfPageTemplate

Returns

bool

Examples

//Loads an existing PDF Document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Total number of elements in the collection
int count = loadedDocument.PdfPageTemplates.Count;
//Gets the PdfPageTemplate at the specified index.
PdfPageTemplate pageTemplate = loadedDocument.PdfPageTemplates[0];
//Determines whether the specified PdfPageTemplate presents in the collection
bool contains = loadedDocument.PdfPageTemplates.Contains(pageTemplate);
//Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate);
//Remove the specified PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.RemoveAt(1);
//Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear();
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close(true);
'Loads an existing PDF Document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Total number of elements in the collection
Dim count As Integer = loadedDocument.PdfPageTemplates.Count
'Gets the PdfPageTemplate at the specified index.
Dim pageTemplate As PdfPageTemplate = loadedDocument.PdfPageTemplates(0)
'Determines whether the specified PdfPageTemplate presents in the collection
Dim contains As Boolean = loadedDocument.PdfPageTemplates.Contains(pageTemplate)
'Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.RemoveAt(1)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear()
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close(True)

Remove(PdfPageTemplate)

Remove the PdfPageTemplate from the document.

public void Remove(PdfPageTemplate pdfPageTemplate)

Parameters

pdfPageTemplate PdfPageTemplate

Examples

//Loads an existing PDF Document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Total number of elements in the collection
int count = loadedDocument.PdfPageTemplates.Count;
//Gets the PdfPageTemplate at the specified index.
PdfPageTemplate pageTemplate = loadedDocument.PdfPageTemplates[0];
//Determines whether the specified PdfPageTemplate presents in the collection
bool contains = loadedDocument.PdfPageTemplates.Contains(pageTemplate);
//Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate);
//Remove the specified PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.RemoveAt(1);
//Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear();
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close(true);
'Loads an existing PDF Document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Total number of elements in the collection
Dim count As Integer = loadedDocument.PdfPageTemplates.Count
'Gets the PdfPageTemplate at the specified index.
Dim pageTemplate As PdfPageTemplate = loadedDocument.PdfPageTemplates(0)
'Determines whether the specified PdfPageTemplate presents in the collection
Dim contains As Boolean = loadedDocument.PdfPageTemplates.Contains(pageTemplate)
'Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.RemoveAt(1)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear()
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close(True)

RemoveAt(int)

Remove the specified PdfPageTemplate from the document.

public void RemoveAt(int index)

Parameters

index int

Examples

//Loads an existing PDF Document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument("input.pdf");
//Total number of elements in the collection
int count = loadedDocument.PdfPageTemplates.Count;
//Gets the PdfPageTemplate at the specified index.
PdfPageTemplate pageTemplate = loadedDocument.PdfPageTemplates[0];
//Determines whether the specified PdfPageTemplate presents in the collection
bool contains = loadedDocument.PdfPageTemplates.Contains(pageTemplate);
//Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate);
//Remove the specified PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.RemoveAt(1);
//Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear();
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close(true);
'Loads an existing PDF Document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Total number of elements in the collection
Dim count As Integer = loadedDocument.PdfPageTemplates.Count
'Gets the PdfPageTemplate at the specified index.
Dim pageTemplate As PdfPageTemplate = loadedDocument.PdfPageTemplates(0)
'Determines whether the specified PdfPageTemplate presents in the collection
Dim contains As Boolean = loadedDocument.PdfPageTemplates.Contains(pageTemplate)
'Remove the PdfPageTemplate from the document.
loadedDocument.PdfPageTemplates.Remove(pageTemplate)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.RemoveAt(1)
'Removes all the PdfPageTemplate from the collection.
loadedDocument.PdfPageTemplates.Clear()
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close(True)