WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfTag

    Show / Hide Table of Contents

    Class PdfTag

    Represents the tag for the element

    Inheritance
    System.Object
    PdfTag
    PdfArtifact
    PdfStructureElement
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Pdf
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public abstract class PdfTag
    Remarks

    To know more about refer this link .

    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

    PdfTag()

    Declaration
    protected PdfTag()

    Properties

    Order

    Gets or sets the order for the element

    Declaration
    public virtual int Order { get; set; }
    Property Value
    Type Description
    System.Int32
    Remarks

    To know more about refer this link .

    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
    PdfDocument
    PdfPage
    PdfTextElement
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved