Class PdfSectionPageCollection
- Namespace
- Syncfusion.Pdf
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents the collection of pages in a PdfSection .
public class PdfSectionPageCollection : IEnumerable
- Inheritance
-
PdfSectionPageCollection
- Implements
- Inherited Members
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Get the page collection from a section.
PdfSectionPageCollection pageCollection = document.Sections[0].Pages;
//Add the page.
PdfPage page = pageCollection.Add();
//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Set the font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
//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()
'Get the page collection from a section.
Dim pageCollection As PdfSectionPageCollection = document.Sections(0).Pages
'Add the page.
Dim page As PdfPage = pageCollection.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Set the font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 20)
'Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
Properties
Count
Gets the count of the pages.
public int Count { get; }
Property Value
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();
//Add the section.
PdfSection section1 = document.Sections.Add();
//Add pages to the section1.
PdfPage page1 = section1.Pages.Add();
//Get the page count in a section.
int count = document.Sections[0].Pages.Count;
//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()
'Add the section.
Dim section1 As PdfSection = document.Sections.Add()
'Add pages to the section1.
Dim page1 As PdfPage = section1.Pages.Add()
'Get the page count in a section.
Dim count As Integer = document.Sections(0).Pages.Count
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also
this[int]
Gets the PdfPage at the specified index.
public PdfPage this[int index] { get; }
Parameters
index
int
Property Value
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Get the page collection from a section.
PdfSectionPageCollection pageCollection = document.Sections[0].Pages;
//Add the page.
PdfPage page = pageCollection.Add();
//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Set the font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
//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()
'Get the page collection from a section.
Dim pageCollection As PdfSectionPageCollection = document.Sections(0).Pages
'Add the page.
Dim page As PdfPage = pageCollection.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Set the font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 20)
'Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also
Methods
Add()
Creates a new page and adds it into the collection.
public PdfPage Add()
Returns
- PdfPage
The new page.
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();
//Add the section.
PdfSection section1 = document.Sections.Add();
//Add pages to the section1.
PdfPage page1 = section1.Pages.Add();
//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Set the font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
//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()
'Add the section.
Dim section1 As PdfSection = document.Sections.Add()
'Add pages to the section1.
Dim page1 As PdfPage = section1.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Set the font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 20)
'Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also
Add(PdfPage)
Adds a page into collection.
public void Add(PdfPage page)
Parameters
page
PdfPageThe page.
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Create a new pdf page.
PdfPage page = new PdfPage();
//Add the page into section.
document.Sections[0].Pages.Add(page);
//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Set the font.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
//Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, new PointF(0, 0));
//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()
'Create a new pdf page.
Dim page As New PdfPage()
'Add the page into section.
document.Sections(0).Pages.Add(page)
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Set the font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 20)
'Draw the text.
graphics.DrawString("Hello World!!!", font, PdfBrushes.Black, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also
Clear()
Clears this collection.
public void Clear()
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Add first page to the section.
PdfPage page = section.Pages.Add();
//Add second page to the section.
PdfPage page1 = section.Pages.Add();
//Clear all the pages from first section of pdf document.
document.Sections[0].Pages.Clear();
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Add the section.
Dim section As PdfSection = document.Sections.Add()
'Add first page to the section.
Dim page As PdfPage = section.Pages.Add()
'Add second page to the section.
Dim page1 As PdfPage = section.Pages.Add()
'Clear all the pages from first section of pdf document.
document.Sections(0).Pages.Clear()
'Save and close the document.
document.Save("Output.pdf")
document.Close(True)
- See Also
Contains(PdfPage)
Determines whether the specified page is within the collection.
public bool Contains(PdfPage page)
Parameters
Returns
- bool
true
if the collection contains the specified page; otherwise,false
.
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add the section.
PdfSection section = document.Sections.Add();
//Add page to the section.
PdfPage page = section.Pages.Add();
//Add the section.
PdfSection section1 = document.Sections.Add();
//Add page to the section1.
PdfPage page1 = section1.Pages.Add();
//check whether the specified page is in collection.
bool isExists = document.Sections[0].Pages.Contains(page1);
//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 page to the section.
Dim page As PdfPage = section.Pages.Add()
'Add the section.
Dim section1 As PdfSection = document.Sections.Add()
'Add page to the section1.
Dim page1 As PdfPage = section1.Pages.Add()
'check whether the specified page is in collection.
Dim isExists As Boolean = document.Sections(0).Pages.Contains(page1)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also
IndexOf(PdfPage)
Returns the index of the specified page.
public int IndexOf(PdfPage page)
Parameters
Returns
- int
Index of the page
if the collection contains the specified page; otherwise,-1
.
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 page.
PdfPage page1 = new PdfPage();
//Get index of the page from Pdf section page collections.
int index = document.Sections[0].Pages.IndexOf(page);
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As PdfDocument = 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 page.
Dim page1 As PdfPage = New PdfPage()
'Get index of the page from Pdf section page collections.
Dim index As Integer = document.Sections(0).Pages.IndexOf(page)
'Save and close the document.
document.Save("Output.pdf")
document.Close(True)
- See Also
Insert(int, PdfPage)
Inserts a page at the specified index.
public void Insert(int index, PdfPage page)
Parameters
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 page.
PdfPage page1 = new PdfPage();
//Insert a page at specified index.
document.Sections[0].Pages.Insert(0, page);
//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 page.
Dim page1 As New PdfPage()
'Insert a page at specified index.
document.Sections(0).Pages.Insert(0, page)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also
Remove(PdfPage)
Removes the specified page from collection.
public void Remove(PdfPage page)
Parameters
page
PdfPageThe page.
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 page.
PdfPage page1 = section.Pages.Add();
//Remove the page from Pdf section page collections.
document.Sections[0].Pages.Remove(page);
//Get page count, it will be one
int count = document.Sections[0].Pages.Count;
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As PdfDocument = 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 page.
Dim page1 As PdfPage = section.Pages.Add()
'Remove the page from Pdf section page collections.
document.Sections(0).Pages.Remove(page)
'Get page count, it will be one
Dim count As Integer = document.Sections(0).Pages.Count
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also
RemoveAt(int)
Removes a page at the specified index.
public void RemoveAt(int index)
Parameters
index
intThe index of the page to be removed.
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();
//Add the section.
PdfSection section1 = document.Sections.Add();
//Add pages to the section1.
PdfPage page1 = section1.Pages.Add();
//Remove the page at specified index.
document.Sections[0].Pages.RemoveAt(0);
//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()
'Add the section.
Dim section1 As PdfSection = document.Sections.Add()
'Add pages to the section1.
Dim page1 As PdfPage = section1.Pages.Add()
'Remove the page at specified index.
document.Sections(0).Pages.RemoveAt(0)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
- See Also