PdfPageTemplateCollection Class
Implements a collection of page template in the document.
Inheritance
System.Object
PdfPageTemplateCollection
Implements
System.Collections.IEnumerable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfPageTemplateCollection : IEnumerable, IPdfWrapper
Properties
Count
Gets number of the elements in the collection.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
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)
Item[Int32]
Gets the PdfPageTemplate at the specified index.
Declaration
public PdfPageTemplate this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type |
---|
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
Declaration
public void Add(PdfPageTemplate pdfPageTemplate)
Parameters
Type | Name | Description |
---|---|---|
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.
Declaration
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.
Declaration
public bool Contains(PdfPageTemplate pdfPageTemplate)
Parameters
Type | Name | Description |
---|---|---|
PdfPageTemplate | pdfPageTemplate |
Returns
Type |
---|
System.Boolean |
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.
Declaration
public void Remove(PdfPageTemplate pdfPageTemplate)
Parameters
Type | Name | Description |
---|---|---|
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(Int32)
Remove the specified PdfPageTemplate from the document.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
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)
Explicit Interface Implementations
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An System.Collections.IEnumerator object that can be used to iterate through the collection. |
Implements
System.Collections.IEnumerable