PdfStructureElement Class
Represents the structure element
Inherited Members
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfStructureElement : PdfTag
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element with tag type heading.
PdfStructureElement header = new PdfStructureElement(PdfTagType.Heading);
//Initialize new instance of structure element with tag type HeadingLevel1.
PdfStructureElement header1 = new PdfStructureElement(PdfTagType.HeadingLevel1);
header1.Parent = header;
//Initialize new instance of structure element with tag type Paragraph.
PdfStructureElement structElement = new PdfStructureElement(PdfTagType.Paragraph);
structElement.Parent = header1;
//Create PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element with tag type heading.
Dim header As PdfStructureElement = New PdfStructureElement(PdfTagType.Heading)
'Initialize new instance of structure element with tag type HeadingLevel1.
Dim header1 As PdfStructureElement = New PdfStructureElement(PdfTagType.HeadingLevel1)
header1.Parent = header
'Initialize new instance of structure element with tag type Paragraph.
Dim structElement As PdfStructureElement = New PdfStructureElement(PdfTagType.Paragraph)
structElement.Parent = header1
'Create PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
Constructors
PdfStructureElement()
Initialize the structure element
Declaration
public PdfStructureElement()
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//set the order for the structure element.
structElement.Order = 1;
//set the title for the structure element.
structElement.Title = "Example Text";
//set the abbrevation for the structure element.
structElement.Abbrevation = "TTT";
//set the actual text for the structure element.
structElement.ActualText = "Text";
//set the alternate text for the structure element.
structElement.AlternateText = "ELement Text";
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'set the order for the structure element.
structElement.Order = 1
'set the title for the structure element.
structElement.Title = "Example Text"
'set the abbrevation for the structure element.
structElement.Abbrevation = "TTT"
'set the actual text for the structure element.
structElement.ActualText = "Text"
'set the alternate text for the structure element.
structElement.AlternateText = "ELement Text"
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
PdfStructureElement(PdfTagType)
Initialize the Structure element
Declaration
public PdfStructureElement(PdfTagType tag)
Parameters
Type | Name | Description |
---|---|---|
PdfTagType | tag | tag type |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element with tag type heading.
PdfStructureElement header = new PdfStructureElement(PdfTagType.Heading);
//Initialize new instance of structure element with tag type HeadingLevel1.
PdfStructureElement header1 = new PdfStructureElement(PdfTagType.HeadingLevel1);
header1.Parent = header;
//Initialize new instance of structure element with tag type Paragraph.
PdfStructureElement structElement = new PdfStructureElement(PdfTagType.Paragraph);
structElement.Parent = header1;
//Create PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element with tag type heading.
Dim header As PdfStructureElement = New PdfStructureElement(PdfTagType.Heading)
'Initialize new instance of structure element with tag type HeadingLevel1.
Dim header1 As PdfStructureElement = New PdfStructureElement(PdfTagType.HeadingLevel1)
header1.Parent = header
'Initialize new instance of structure element with tag type Paragraph.
Dim structElement As PdfStructureElement = New PdfStructureElement(PdfTagType.Paragraph)
structElement.Parent = header1
'Create PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
Properties
Abbrevation
Gets or sets the abbreviation associated with the structure element.
Declaration
public string Abbrevation { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//set the order for the structure element.
structElement.Order = 1;
//set the title for the structure element.
structElement.Title = "Example Text";
//set the abbrevation for the structure element.
structElement.Abbrevation = "TTT";
//set the actual text for the structure element.
structElement.ActualText = "Text";
//set the alternate text for the structure element.
structElement.AlternateText = "ELement Text";
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'set the order for the structure element.
structElement.Order = 1
'set the title for the structure element.
structElement.Title = "Example Text"
'set the abbrevation for the structure element.
structElement.Abbrevation = "TTT"
'set the actual text for the structure element.
structElement.ActualText = "Text"
'set the alternate text for the structure element.
structElement.AlternateText = "ELement Text"
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
ActualText
Gets or sets the actual text associated with the structure element.
Declaration
public string ActualText { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//set the order for the structure element.
structElement.Order = 1;
//set the title for the structure element.
structElement.Title = "Example Text";
//set the abbrevation for the structure element.
structElement.Abbrevation = "TTT";
//set the actual text for the structure element.
structElement.ActualText = "Text";
//set the alternate text for the structure element.
structElement.AlternateText = "ELement Text";
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'set the order for the structure element.
structElement.Order = 1
'set the title for the structure element.
structElement.Title = "Example Text"
'set the abbrevation for the structure element.
structElement.Abbrevation = "TTT"
'set the actual text for the structure element.
structElement.ActualText = "Text"
'set the alternate text for the structure element.
structElement.AlternateText = "ELement Text"
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
AlternateText
Gets or sets the alternate text associated with the structure element.
Declaration
public string AlternateText { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//set the order for the structure element.
structElement.Order = 1;
//set the title for the structure element.
structElement.Title = "Example Text";
//set the abbrevation for the structure element.
structElement.Abbrevation = "TTT";
//set the actual text for the structure element.
structElement.ActualText = "Text";
//set the alternate text for the structure element.
structElement.AlternateText = "ELement Text";
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'set the order for the structure element.
structElement.Order = 1
'set the title for the structure element.
structElement.Title = "Example Text"
'set the abbrevation for the structure element.
structElement.Abbrevation = "TTT"
'set the actual text for the structure element.
structElement.ActualText = "Text"
'set the alternate text for the structure element.
structElement.AlternateText = "ELement Text"
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
Bounds
Gets the rectangular bounds of the structure element on the page.
Declaration
public RectangleF Bounds { get; }
Property Value
Type |
---|
System.Drawing.RectangleF |
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.StrutureElements;
//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.StrutureElements
//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)
ChildElements
Gets an array of child structure elements of the current structure element.
Declaration
public PdfStructureElement[] ChildElements { get; }
Property Value
Type |
---|
PdfStructureElement[] |
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.StrutureElements;
//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.StrutureElements
//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)
Language
Gets or sets the language of the structure element.
Declaration
public string Language { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//set the order for the structure element.
structElement.Order = 1;
//set the title for the structure element.
structElement.Title = "Example Text";
//set the abbrevation for the structure element.
structElement.Abbrevation = "TTT";
//set the actual text for the structure element.
structElement.ActualText = "Text";
//set the language for the structure element
structElement.Language = "en-Us";
//set the alternate text for the structure element.
structElement.AlternateText = "ELement Text";
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'set the order for the structure element.
structElement.Order = 1
'set the title for the structure element.
structElement.Title = "Example Text"
'set the abbrevation for the structure element.
structElement.Abbrevation = "TTT"
'set the actual text for the structure element.
structElement.ActualText = "Text"
'set the language for the structure element.
structElement.Language = "en-Us";
'set the alternate text for the structure element.
structElement.AlternateText = "ELement Text"
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
Order
Gets or sets the order of the structure element.
Declaration
public override int Order { get; set; }
Property Value
Type |
---|
System.Int32 |
Overrides
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//set the order for the structure element.
structElement.Order = 1;
//set the title for the structure element.
structElement.Title = "Example Text";
//set the abbrevation for the structure element.
structElement.Abbrevation = "TTT";
//set the actual text for the structure element.
structElement.ActualText = "Text";
//set the alternate text for the structure element.
structElement.AlternateText = "ELement Text";
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'set the order for the structure element.
structElement.Order = 1
'set the title for the structure element.
structElement.Title = "Example Text"
'set the abbrevation for the structure element.
structElement.Abbrevation = "TTT"
'set the actual text for the structure element.
structElement.ActualText = "Text"
'set the alternate text for the structure element.
structElement.AlternateText = "ELement Text"
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
Page
Retrieves the page instance where the structure element is present.
Declaration
public PdfPageBase Page { get; }
Property Value
Type |
---|
PdfPageBase |
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.StrutureElements;
//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.StrutureElements
//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)
Parent
Gets or sets the parent structure element of the current structure element.
Declaration
public PdfStructureElement Parent { get; set; }
Property Value
Type |
---|
PdfStructureElement |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element with tag type heading.
PdfStructureElement header = new PdfStructureElement(PdfTagType.Heading);
//Initialize new instance of structure element with tag type HeadingLevel1.
PdfStructureElement header1 = new PdfStructureElement(PdfTagType.HeadingLevel1);
header1.Parent = header;
//Initialize new instance of structure element with tag type Paragraph.
PdfStructureElement structElement = new PdfStructureElement(PdfTagType.Paragraph);
structElement.Parent = header1;
//Create PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element with tag type heading.
Dim header As PdfStructureElement = New PdfStructureElement(PdfTagType.Heading)
'Initialize new instance of structure element with tag type HeadingLevel1.
Dim header1 As PdfStructureElement = New PdfStructureElement(PdfTagType.HeadingLevel1)
header1.Parent = header
'Initialize new instance of structure element with tag type Paragraph.
Dim structElement As PdfStructureElement = New PdfStructureElement(PdfTagType.Paragraph)
//Set parent for structure element.
structElement.Parent = header1
'Create PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
Scope
Gets or sets the scope of the structure element.
Declaration
public ScopeType Scope { get; set; }
Property Value
Type |
---|
ScopeType |
Examples
//Creates a new PDF document
PdfDocument pdfDocument = new PdfDocument();
pdfDocument.DocumentInformation.Title = "Table";
//Adds new page
PdfPage pdfPage = pdfDocument.Pages.Add();
//Initialize the new structure element with tag type table
PdfStructureElement element = new PdfStructureElement(PdfTagType.Table);
//Create a new PdfGrid
PdfGrid pdfGrid = new PdfGrid();
//Adding tag to PDF grid
pdfGrid.PdfTag = element;
//Add three columns
pdfGrid.Columns.Add(3);
//Add header
pdfGrid.Headers.Add(1);
PdfGridRow pdfGridHeader = pdfGrid.Headers[0];
pdfGridHeader.Style.Font = new PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Bold);
pdfGridHeader.Style.TextBrush = PdfBrushes.Brown;
//Adding tag for each row with tag type TR
pdfGridHeader.PdfTag = new PdfStructureElement(PdfTagType.TableRow);
pdfGridHeader.Cells[0].Value = "Employee ID";
//Adding tag for header cell with tag type TH
pdfGridHeader.Cells[0].PdfTag = new PdfStructureElement(PdfTagType.TableHeader) { Scope = ScopeType.Both };
pdfGridHeader.Cells[1].Value = "Employee Name";
//Adding tag for header cell with tag type TH
pdfGridHeader.Cells[1].PdfTag = new PdfStructureElement(PdfTagType.TableHeader) { Scope = ScopeType.Row};
pdfGridHeader.Cells[2].Value = "Salary";
//Adding tag for header cell with tag type TH
pdfGridHeader.Cells[2].PdfTag = new PdfStructureElement(PdfTagType.TableHeader) { Scope = ScopeType.Column };
//Add rows.
PdfGridRow pdfGridRow = pdfGrid.Rows.Add();
pdfGridRow.PdfTag = new PdfStructureElement(PdfTagType.TableRow);
pdfGridRow.Cells[0].Value = "E01";
pdfGridRow.Cells[1].Value = "Clay";
pdfGridRow.Cells[2].Value = "$10,000";
//Adding tag for each cell with tag type TD
pdfGridRow.Cells[0].PdfTag = new PdfStructureElement(PdfTagType.TableDataCell);
pdfGridRow.Cells[1].PdfTag = new PdfStructureElement(PdfTagType.TableDataCell);
pdfGridRow.Cells[2].PdfTag = new PdfStructureElement(PdfTagType.TableDataCell);
//Draw the PdfGrid
pdfGrid.Draw(pdfPage, PointF.Empty);
//save the document and dispose it
pdfDocument.Save("Output.pdf");
//close the document
pdfDocument.Close(true);
'Creates a new PDF document
Dim pdfDocument As PdfDocument = New PdfDocument()
pdfDocument.DocumentInformation.Title = "Table"
'Adds new page
Dim pdfPage As PdfPage = pdfDocument.Pages.Add()
'Initialize the new structure element with tag type table
Dim element As PdfStructureElement = New PdfStructureElement(PdfTagType.Table)
'Create a new PdfGrid
Dim pdfGrid As PdfGrid = New PdfGrid()
'Adding tag to PDF grid
pdfGrid.PdfTag = element
'Add three columns
pdfGrid.Columns.Add(3)
'Add header.
pdfGrid.Headers.Add(1)
Dim pdfGridHeader As PdfGridRow = pdfGrid.Headers(0)
pdfGridHeader.Style.Font = New PdfStandardFont(PdfFontFamily.Helvetica, 12, PdfFontStyle.Bold)
pdfGridHeader.Style.TextBrush = PdfBrushes.Brown
'Adding tag for each row with tag type TR
pdfGridHeader.PdfTag = New PdfStructureElement(PdfTagType.TableRow)
pdfGridHeader.Cells(0).Value = "Employee ID"
'Adding tag for header cell with tag type TH
pdfGridHeader.Cells(0).PdfTag = New PdfStructureElement(PdfTagType.TableHeader) With {.Scope = ScopeType.Row}
pdfGridHeader.Cells(1).Value = "Employee Name"
'Adding tag for header cell with tag type TH
pdfGridHeader.Cells(0).PdfTag = New PdfStructureElement(PdfTagType.TableHeader) With {.Scope = ScopeType.Column}
pdfGridHeader.Cells(2).Value = "Salary"
'Adding tag for header cell with tag type TH
pdfGridHeader.Cells(0).PdfTag = New PdfStructureElement(PdfTagType.TableHeader) With {.Scope = ScopeType.Both}
'Add rows.
Dim pdfGridRow As PdfGridRow = pdfGrid.Rows.Add()
pdfGridRow.PdfTag = New PdfStructureElement(PdfTagType.TableRow)
pdfGridRow.Cells(0).Value = "E01"
pdfGridRow.Cells(1).Value = "Clay"
pdfGridRow.Cells(2).Value = "$10,000"
'Adding tag for each cell with tag type TD
pdfGridRow.Cells(0).PdfTag = New PdfStructureElement(PdfTagType.TableDataCell)
pdfGridRow.Cells(1).PdfTag = New PdfStructureElement(PdfTagType.TableDataCell)
pdfGridRow.Cells(2).PdfTag = New PdfStructureElement(PdfTagType.TableDataCell)
'Draw the PdfGrid
pdfGrid.Draw(pdfPage, PointF.Empty)
'save the document and dispose it
pdfDocument.Save("Output.pdf")
pdfDocument.Close(True)
TagType
Gets or sets the type of the tag associated with the structure element.
Declaration
public PdfTagType TagType { get; set; }
Property Value
Type |
---|
PdfTagType |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//Set the tag type.
structElement.TagType = PdfTagType.HeadingLevel1;
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'Set the tag type.
structElement.TagType = PdfTagType.HeadingLevel1;
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)
See Also
Text
Gets the text content associated with the structure element.
Declaration
public string Text { get; }
Property Value
Type |
---|
System.String |
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.StrutureElements;
//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.StrutureElements
//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)
Title
Gets or sets the title associated with the structure element.
Declaration
public string Title { get; set; }
Property Value
Type |
---|
System.String |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//Set auto tag value.
document.AutoTag = true;
//Add new pdf page.
PdfPage page = document.Pages.Add();
//Initialize new instance of structure element.
PdfStructureElement structElement = new PdfStructureElement();
//set the order for the structure element.
structElement.Order = 1;
//set the title for the structure element.
structElement.Title = "Example Text";
//set the abbrevation for the structure element.
structElement.Abbrevation = "TTT";
//set the actual text for the structure element.
structElement.ActualText = "Text";
//set the alternate text for the structure element.
structElement.AlternateText = "ELement Text";
//set the parent for the structure element.
structElement.Parent = new PdfStructureElement(PdfTagType.Heading);
//Create new PDF text element.
PdfTextElement element = new PdfTextElement(@"Syncfusion Essential studio tool");
element.PdfTag = structElement;
//Set font for text element.
element.Font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
//Set brush for text element.
element.Brush = new PdfSolidBrush(new PdfColor(89, 89, 93));
//Draw text element into pdf page.
element.Draw(page, new RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200));
//Save and close the document.
document.Save("Output.pdf");
document.Close(true);
'Create a new document.
Dim document As PdfDocument = New PdfDocument()
'Set auto tag value.
document.AutoTag = True
'Add new pdf page.
Dim page As PdfPage = document.Pages.Add()
'Initialize new instance of structure element.
Dim structElement As PdfStructureElement = New PdfStructureElement()
'set the order for the structure element.
structElement.Order = 1
'set the title for the structure element.
structElement.Title = "Example Text"
'set the abbrevation for the structure element.
structElement.Abbrevation = "TTT"
'set the actual text for the structure element.
structElement.ActualText = "Text"
'set the alternate text for the structure element.
structElement.AlternateText = "ELement Text"
'set the parent for the structure element.
structElement.Parent = New PdfStructureElement(PdfTagType.Heading)
'Create new PDF text element.
Dim element As PdfTextElement = New PdfTextElement("Syncfusion Essential studio tool")
element.PdfTag = structElement
'Set font for text element.
element.Font = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Set brush for text element.
element.Brush = New PdfSolidBrush(New PdfColor(89, 89, 93))
'Draw text element into pdf page.
element.Draw(page, New RectangleF(0, 0, page.Graphics.ClientSize.Width / 2, 200))
'Save and Close the document.
document.Save("Output.pdf")
document.Close(True)