Artifact

Represents an artifact.

public class Artifact : Tag
Public Class Artifact
    Inherits Tag

Inheritance: ObjectResourceTagArtifact

Examples

The following example shows how to use page numbering in a document and how to use artifact.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements

Module MyModule
		
    Sub Main()
		
        ' Create a PDF Document
        Dim MyDocument As Document = New Document 
		
        ' Specify document as a tagged PDF
        MyDocument.Tag = New TagOptions()

        ' Create a document template and add it to the document
        Dim documentTemplate As Template = New Template()
        MyDocument.Template = documentTemplate

        Dim MyNumberText As String = "PageNumberingLabels contain page numbering: %%CP%% of %%TP%% pages."

        ' Create a Page numbering label
        Dim MyPageNumberingLabel As PageNumberingLabel = New PageNumberingLabel(MyNumberText, 0, 680, 512, 12, Font.Helvetica, _
                12, TextAlign.Center)

        ' Create an artifact and set its type to pagination
        Dim MyArtifact As Artifact = New Artifact()
        MyArtifact.SetType(ArtifactType.Pagination)
        
        ' Tag the page numbering label with the artifact
        MyPageNumberingLabel.Tag = MyArtifact
        
        ' Add page numbering label to the document template
        documentTemplate.Elements.Add(MyPageNumberingLabel)

        ' Begin the first section
        MyDocument.Sections.Begin(NumberingStyle.RomanLowerCase)

        ' Add three pages to the document
        Dim MyPage1 As Page = New Page()
        MyPage1.Elements.Add(New Label("This is the first page", 100, 100, 200, 100))
        MyDocument.Pages.Add(MyPage1)

        Dim MyPage2 As Page = New Page()
        MyPage2.Elements.Add(New Label("This is the second page", 100, 100, 200, 100))
        MyDocument.Pages.Add(MyPage2)

        Dim MyPage3 As Page = New Page()
        MyPage3.Elements.Add(New Label("This is the third page", 100, 100, 200, 100))
        MyDocument.Pages.Add(MyPage3)

        ' Save the PDF
        MyDocument.Draw("C:\MyDocument.pdf")
		
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
    public static void CreatePDF(string outputPath)
    {
        // Create a PDF Document
        Document document = new Document();

        // Specify document as a tagged PDF
        document.Tag = new TagOptions();
		
        // Create a document template and add it to the document
        Template documentTemplate = new Template();
        document.Template = documentTemplate;

        string numberText = "PageNumberingLabels contain page numbering: %%CP%% of %%TP%% pages.";

        // Create a Page numbering label
        PageNumberingLabel pageNumberingLabel = new PageNumberingLabel(numberText, 0, 680, 512, 12, Font.Helvetica,
                    12, TextAlign.Center);

        // Create an artifact and add its type to pagination
        Artifact artifact = new Artifact();
        artifact.SetType(ArtifactType.Pagination);

        // Tag the page numbering label with the artifact
        pageNumberingLabel.Tag = artifact;

        // Add page numbering label to the document template
        documentTemplate.Elements.Add(pageNumberingLabel);

        // Begin the first section
        document.Sections.Begin(NumberingStyle.RomanLowerCase);

        // Add three pages to the document
        Page page1 = new Page();
        page1.Elements.Add(new Label("This is the first page", 100, 100, 200, 100));
        document.Pages.Add(page1);

        Page page2 = new Page();
        page2.Elements.Add(new Label("This is the second page", 100, 100, 200, 100));
        document.Pages.Add(page2);

        Page page3 = new Page();
        page3.Elements.Add(new Label("This is the third page", 100, 100, 200, 100));
        document.Pages.Add(page3);

        // Save the PDF
        document.Draw( outputPath );
    }
}

Constructors

Artifact()Initializes a new instance of the Artifact class.
Artifact(ArtifactType, Attached)Initializes a new instance of the Artifact class.
Artifact(ArtifactType, Attached, SubType)Initializes a new instance of the Artifact class.
Artifact(ArtifactType, BoundingBox, Attached, SubType)Initializes a new instance of the Artifact class.
Artifact(ArtifactType, SubType)Initializes a new instance of the Artifact class.
Artifact(BoundingBox)Initializes a new instance of the Artifact class.

Properties

RequiredPdfObjectsGets the number of PDF objects required by the resource.
(Inherited from Resource)
ResourceTypeGets the type of resource.
(Inherited from Resource)
TagTypeGets a value indicating artifact tag
UidGets the unique ID of the resource.
(Inherited from Resource)

Methods

Draw(DocumentWriter)Draws the artifact to the given DocumentWriter object.
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
SetAttached(Attached)Sets a Attached to the Artifact .
SetBoundingBox()Sets a BoundingBox Attribute to the Artifact with default value.
SetBoundingBox(BoundingBox)Sets a BoundingBox to the Artifact .
SetSubType(SubType)Sets a SubType to the Artifact .
SetType(ArtifactType)Sets a ArtifactType to the Artifact .
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF

In this topic