cete.dynamicpdf.artifact
Artifact
- Namespace: ceTe.DynamicPDF
- Assemblies: ceTe.DynamicPDF.40.dll
Represents an artifact.
public class Artifact : Tag
Public Class Artifact
Inherits Tag
Inheritance: Object → Resource → Tag → Artifact
Licensing
This class is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
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;
class MyClass
{static void Main(){ // 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( @"C:\MyDocument.pdf" );}
}
Constructors
Artifact()
Initializes a new instance of the Artifact class.
public Artifact()
Public Sub New ()
Artifact(ArtifactType, Attached)
Initializes a new instance of the Artifact class.
public Artifact(ArtifactType type, Attached attached)
Public Sub New (type As ArtifactType, attached As Attached)
Parameters
- type: ArtifactType
Type of artifact.
- attached: Attached
A value indicating to which the artifact is logically attached.
Artifact(ArtifactType, Attached, SubType)
Initializes a new instance of the Artifact class.
public Artifact(ArtifactType type, Attached attached, SubType subType)
Public Sub New (type As ArtifactType, attached As Attached, subType As SubType)
Parameters
- type: ArtifactType
Type of artifact.
- attached: Attached
A value indicating to which the artifact is logically attached.
- subType: SubType
Sub type of the artifact.
Artifact(ArtifactType, BoundingBox, Attached, SubType)
Initializes a new instance of the Artifact class.
public Artifact(ArtifactType type, BoundingBox bBox, Attached attached, SubType subType)
Public Sub New (type As ArtifactType, bBox As BoundingBox, attached As Attached, subType As SubType)
Parameters
- type: ArtifactType
Type of artifact.
- bBox: BoundingBox
Bounding box of the artifact.
- attached: Attached
A value indicating to which the artifact is logically attached.
- subType: SubType
Sub type of the artifact.
Artifact(ArtifactType, SubType)
Initializes a new instance of the Artifact class.
public Artifact(ArtifactType type, SubType subType)
Public Sub New (type As ArtifactType, subType As SubType)
Parameters
- type: ArtifactType
Type of artifact.
- subType: SubType
Sub type of the artifact.
Artifact(BoundingBox)
Initializes a new instance of the Artifact class.
public Artifact(BoundingBox bBox)
Public Sub New (bBox As BoundingBox)
Parameters
- bBox: BoundingBox
Bounding box of the artifact.
Properties
RequiredPdfObjects
Gets the number of PDF objects required by the resource. (Inherited from Resource)
public int RequiredPdfObjects { get; }
Public Property RequiredPdfObjects As Int32
Property Value
ResourceType
Gets the type of resource. (Inherited from Resource)
public ResourceType ResourceType { get; }
Public Property ResourceType As ResourceType
Property Value
TagType
Gets a value indicating artifact tag
public TagType TagType { get; }
Public Property TagType As TagType
Property Value
Uid
Gets the unique ID of the resource. (Inherited from Resource)
public long Uid { get; }
Public Property Uid As Int64
Property Value
Methods
Draw(DocumentWriter)
Draws the artifact to the given DocumentWriter object.
public void Draw(DocumentWriter writer)
Sub Draw(writer As DocumentWriter)
Parameters
- writer: DocumentWriter
DocumentWriter object to receive the artifact output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
SetAttached(Attached)
Sets a Attached to the Artifact .
public void SetAttached(Attached attached)
Sub SetAttached(attached As Attached)
Parameters
- attached: Attached
value of Attached
SetBoundingBox()
Sets a BoundingBox Attribute to the Artifact with default value.
public void SetBoundingBox()
Sub SetBoundingBox()
SetBoundingBox(BoundingBox)
Sets a BoundingBox to the Artifact .
public void SetBoundingBox(BoundingBox boundingBox)
Sub SetBoundingBox(boundingBox As BoundingBox)
Parameters
- boundingBox: BoundingBox
value of BoundingBox
SetSubType(SubType)
Sets a SubType to the Artifact .
public void SetSubType(SubType subType)
Sub SetSubType(subType As SubType)
Parameters
- subType: SubType
value of SubType
SetType(ArtifactType)
Sets a ArtifactType to the Artifact .
public void SetType(ArtifactType type)
Sub SetType(type As ArtifactType)
Parameters
- type: ArtifactType
value of Type
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .