Class PdfLoadedPage
Represents a page loaded from a PDF document.
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.NET.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 |
---|---|
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 |
---|---|
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
CropBox
Gets the visible region of the page (Read only).
Declaration
public RectangleF CropBox { get; }
Property Value
Type | Description |
---|---|
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 |
---|---|
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
Size
Gets the size of the page (Read only).
Declaration
public override SizeF Size { get; }
Property Value
Type | Description |
---|---|
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 |
---|---|
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
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 |