PdfLoadedPage Class
Represents a page loaded from a PDF document.
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfLoadedPage : PdfPageBase, IPdfWrapper
Examples
//Load the document
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf");
//get the first page from the document
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage;
//Get the annotation collection
PdfLoadedAnnotationCollection annotations = page.Annotations;
//Save the document
lDoc.Save("output.pdf");
lDoc.Close(true);
'Load the document
Dim lDoc As New PdfLoadedDocument("input.pdf")
'get the first page from the document
Dim page As PdfLoadedPage = TryCast(lDoc.Pages(0), PdfLoadedPage)
'Get the annotation collection
Dim annotations As PdfLoadedAnnotationCollection = page.Annotations
'Save the document
lDoc.Save("output.pdf")
lDoc.Close(True)
Properties
Annotations
Gets or Sets the collection of the page's annotations.
Declaration
public PdfLoadedAnnotationCollection Annotations { get; set; }
Property Value
Type | Description |
---|---|
PdfLoadedAnnotationCollection | The PdfLoadedAnnotationCollection that represents the page's annotations |
Examples
//Load the document.
PdfLoadedDocument lDoc = new PdfLoadedDocument("inputAnnotation.pdf");
//get the first page from the document.
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage;
//Get the annotation collection.
PdfLoadedAnnotationCollection annotations = page.Annotations;
//Save the document.
lDoc.Save("sample.pdf");
lDoc.Close(true);
'Load the document.
Dim lDoc As New PdfLoadedDocument("inputAnnotation.pdf")
'Get the first page from the document.
Dim page As PdfLoadedPage = TryCast(lDoc.Pages(0), PdfLoadedPage)
'Get the annotation collections.
Dim annotations As PdfLoadedAnnotationCollection = page.Annotations
'Save the document.
lDoc.Save("sample.pdf")
lDoc.Close(True)
See Also
ArtBox
Gets page region containing meaningful content (Read only).
Declaration
public RectangleF ArtBox { get; }
Property Value
Type | Description |
---|---|
System.Drawing.RectangleF | The RectangleF that represents the art box of the page |
Remarks
Art box is only read only, we cann't set value for loaded page art box.
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
//Get first page of loaded document.
PdfLoadedPage lpage = document.Pages[0] as PdfLoadedPage;
//Get loaded page art box value.
RectangleF rect = lpage.ArtBox;
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get first page of loaded document.
Dim lpage As PdfLoadedPage = TryCast(document.Pages(0), PdfLoadedPage)
'Get loaded page art box value.
Dim rect As RectangleF = lpage.ArtBox
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
BleedBox
Gets page region after clipping (Read only).
Declaration
public RectangleF BleedBox { get; }
Property Value
Type | Description |
---|---|
System.Drawing.RectangleF | The RectangleF that represents the bleed box of a page |
Remarks
Bleed box is only read only, we cann't set value for loaded page bleed box.
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
//Get first page of loaded document.
PdfLoadedPage lpage = document.Pages[0] as PdfLoadedPage;
//Get loaded page bleed box value.
RectangleF rect = lpage.BleedBox;
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get first page of loaded document.
Dim lpage As PdfLoadedPage = TryCast(document.Pages(0), PdfLoadedPage)
'Get loaded page bleed box value.
Dim rect As RectangleF = lpage.BleedBox
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
ColorSpace
Gets the ColorSpace details(Read only).
Declaration
public string[] ColorSpace { get; }
Property Value
Type |
---|
System.String[] |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
//Get first page of loaded document.
PdfLoadedPage lpage = document.Pages[0] as PdfLoadedPage;
//Get loaded page base document.
string colorSpace = page.ColorSpace;
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
See Also
CropBox
Gets the visible region of the page (Read only).
Declaration
public RectangleF CropBox { get; }
Property Value
Type | Description |
---|---|
System.Drawing.RectangleF | The RectangleF that represents the crop box of the page |
Remarks
Crop box is only read only, we cann't set value for loaded page crop box value.
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
//Get first page of loaded document.
PdfLoadedPage lpage = document.Pages[0] as PdfLoadedPage;
//Get loaded page crop box value.
RectangleF rect = lpage.CropBox;
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get first page of loaded document.
Dim lpage As PdfLoadedPage = TryCast(document.Pages(0), PdfLoadedPage)
'Get loaded page crop box value.
Dim rect As RectangleF = lpage.CropBox
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
Document
Gets the base document (Read only).
Declaration
public PdfDocumentBase Document { get; }
Property Value
Type | Description |
---|---|
PdfDocumentBase | The PdfDocumentBase, which is base class of PdfLoadedDocument |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
//Get first page of loaded document.
PdfLoadedPage lpage = document.Pages[0] as PdfLoadedPage;
//Get loaded page base document.
PdfLoadedDocument basedoc = lpage.Document as PdfLoadedDocument;
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get first page of loaded document.
Dim lpage As PdfLoadedPage = TryCast(document.Pages(0), PdfLoadedPage)
'Get loaded page base document.
Dim basedoc As PdfLoadedDocument = TryCast(lpage.Document, PdfLoadedDocument)
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
MediaBox
Gets the media box of the PDF page (Read only).
Declaration
public RectangleF MediaBox { get; }
Property Value
Type | Description |
---|---|
System.Drawing.RectangleF | The RectangleF that represents the media box of the page, which is intended to be displayed or printed. |
Remarks
Media box is only read only, we cann't set value for loaded page Media box value.
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
//Get first page of loaded document.
PdfLoadedPage lpage = document.Pages[0] as PdfLoadedPage;
//Get loaded page Media box value.
RectangleF rect = lpage.MediaBox;
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get first page of loaded document.
Dim lpage As PdfLoadedPage = TryCast(document.Pages(0), PdfLoadedPage)
'Get loaded page Media box value.
Dim rect As RectangleF = lpage.MediaBox
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
Redactions
Gets collection of the page's redactions.
Declaration
public List<PdfRedaction> Redactions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<PdfRedaction> | list of redaction objects |
Examples
//Load the document.
PdfLoadedDocument lDoc = new PdfLoadedDocument("input.pdf");
//Get the first page from the document.
PdfLoadedPage page = lDoc.Pages[0] as PdfLoadedPage;
//Create a redaction object
PdfRedaction redaction = new PdfRedaction(new RectangleF(40, 40, 50, 20));
//Set fill color for the redaction bounds
redaction.FillColor = System.Drawing.Color.Green;
//Add redaction object into redaction collection of loaded page
page.Redactions.Add(redaction);
//Save and Close the document.
lDoc.Save("sample.pdf");
lDoc.Close(true);
'Load the document.
Dim lDoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
//Create a redaction object
Dim redaction As PdfRedaction = New PdfRedaction(New RectangleF(40, 40, 50, 20))
//Set fill color for the redaction bounds
redaction.FillColor = Color.Green
//Add redaction object into collection
page.Redactions.Add(redaction)
'Save the document.
lDoc.Save("sample.pdf")
lDoc.Close(True)
Size
Gets the size of the page (Read only).
Declaration
public override SizeF Size { get; }
Property Value
Type | Description |
---|---|
System.Drawing.SizeF | The SizeF that represents the size of the page |
Overrides
StructureElements
Gets the collection of structure elements in the loaded PDF page. Structure elements represent logical units of content in the page, such as headings, paragraphs, and tables.
Declaration
public PdfStructureElement[] StructureElements { get; }
Property Value
Type |
---|
PdfStructureElement[] |
Remarks
The logical structure hierarchy in a PDF document is composed of a tree of structure elements, with the root element at the top and the individual content items at the leaves. Each page in the document may contain a separate logical structure hierarchy, which is represented by the collection of structure elements returned by this property.
Examples
FileStream fileStream = File.OpenRead("TaggedPDF.pdf");
//Load existing PDF document.
PdfLoadedDocument document = new PdfLoadedDocument(fileStream);
//Get the structure element root from document.
PdfStructureElement rootElement = document.StructureElement;
//Get the first page from the document.
PdfLoadedPage loadedPage = document.Pages[0] as PdfLoadedPage;
//Get the structure elements associated with the page.
PdfStructureElement[] pageElements = loadedPage.StructureElements;
//Get the first element from the page.
PdfStructureElement element = pageElements[0];
//Get the element properties.
string abbrevation = element.Abbrevation;
string ActualText = element.ActualText;
string AlternateText = element.AlternateText;
string Language = element.Language;
int Order = element.Order;
PdfTagType TagType = element.TagType;
string Title = element.Title;
ScopeType scope = element.Scope;
//Gets the parent and child for first element.
PdfStructureElement parent = element.Parent;
//Gets the child elements for the element.
PdfStructureElement[] child = element.ChildElements;
//Gets the page bounds for the element.
RectangleF bounds = element.Bounds;
//Save the document.
MemoryStream stream = new MemoryStream();
document.Save(stream);
document.Close(true);
Dim fileStream As FileStream = File.OpenRead("TaggedPDF.pdf")
//Load existing PDF document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument(fileStream)
//Get the structure element root from document.
Dim rootElement As PdfStructureElement = document.StructureElement
//Get the first page from the document.
Dim loadedPage As PdfLoadedPage = CType(document.Pages(0),PdfLoadedPage)
//Get the structure elements associated with the page.
Dim pageElements() As PdfStructureElement = loadedPage.StructureElements
//Get the first element from the page.
Dim element As PdfStructureElement = pageElements(0)
//Get the element properties.
Dim abbrevation As String = element.Abbrevation
Dim ActualText As String = element.ActualText
Dim AlternateText As String = element.AlternateText
Dim Language As String = element.Language
Dim Order As Integer = element.Order
Dim TagType As PdfTagType = element.TagType
Dim Title As String = element.Title
Dim scope As ScopeType = element.Scope
//Gets the parent and child for first element.
Dim parent As PdfStructureElement = element.Parent
//Gets the child elements for the element.
Dim child() As PdfStructureElement = element.ChildElements
//Gets the page bounds for the element.
Dim bounds As RectangleF = element.Bounds
//Save the document.
Dim stream As MemoryStream = New MemoryStream
document.Save(stream)
document.Close(true)
TrimBox
Returns page region after trimming (Read only).
Declaration
public RectangleF TrimBox { get; }
Property Value
Type | Description |
---|---|
System.Drawing.RectangleF | The RectangleF that represents the trim box of a page |
Remarks
Trim box is only read only, we cann't set value for loaded page trim box.
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument("input.pdf");
//Get first page of loaded document.
PdfLoadedPage lpage = document.Pages[0] as PdfLoadedPage;
//Get loaded page trim box value.
RectangleF rect = lpage.TrimBox;
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Load an existing document.
Dim document As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Get first page of loaded document.
Dim lpage As PdfLoadedPage = TryCast(document.Pages(0), PdfLoadedPage)
'Get loaded page trim box value.
Dim rect As RectangleF = lpage.TrimBox
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
Methods
AddRedaction(PdfRedaction)
Add redaction to the PDF page.
Declaration
public void AddRedaction(PdfRedaction redaction)
Parameters
Type | Name | Description |
---|---|---|
PdfRedaction | redaction |
Examples
//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
//Create a redaction object
PdfRedaction redaction = new PdfRedaction(new RectangleF(343, 167, 100, 25), Color.Black);
//Add redaction object into redaction collection of loaded page
page.AddRedaction(redaction);
//Redact the contents from PDF document.
loadedDocument.Redact();
//Creating the stream object
MemoryStream stream = new MemoryStream();
//Save the document into stream.
loadedDocument.Save(stream);
//Close the documents.
loadedDocument.Close(true);
'Load the existing PDF document
Dim loadedDocument As PdfLoadedDocument = New PdfLoadedDocument(docStream)
'Create a redaction object
Dim redaction As PdfRedaction = New PdfRedaction(New RectangleF(343, 167, 100, 25), Color.Black)
'Add redaction object into redaction collection of loaded page
page.AddRedaction(redaction)
'Redact the contents from PDF document.
loadedDocument.Redact()
'Creating the stream object
Dim stream As MemoryStream = New MemoryStream()
'Save the document into stream.
loadedDocument.Save(stream)
'Close the document.
loadedDocument.Close(True)
OnBeginSave(EventArgs)
Raises BeginSave event.
Declaration
protected virtual void OnBeginSave(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | Event arguments. |
Events
BeginSave
Raises before the page saves.
Declaration
public event EventHandler BeginSave
Event Type
Type |
---|
System.EventHandler |