Click or drag to resize

DrawingTemplate Class

A DrawingTemplate is a representation of a reusable drawing to be placed on a page or to be used to set or replace the appearance of an annotation on a page. DrawingTemplate objects are never used directly. Instead, after they are created they are stored in a document's Resources property and referenced throughout the document by the resource name instead of using the DrawingTemplate directly. DrawingTemplate objects themselves may refer to other resources including image, font, colorspace, and template resources. DrawingTemplate objects have a Bounds property that specifies the area in which the DrawingTemplate will be constrained when drawn. Any marks outside of this box will be clipped out of view. To use a DrawingTemplate within a page or another template, make a PdfTemplateShape that references the template's resource name. The PdfTemplateShape can be put into the page's DrawingList. To build the visual components of a template, make shape objects and put them in the template's DrawingList.
Inheritance Hierarchy
SystemObject
  Atalasoft.PdfDoc.Generating.TemplatesDrawingTemplate

Namespace:  Atalasoft.PdfDoc.Generating.Templates
Assembly:  Atalasoft.PdfDoc (in Atalasoft.PdfDoc.dll) Version: 11.0.0.0.0.297 (.NET 4.5.2, x86)
Syntax
public class DrawingTemplate

The DrawingTemplate type exposes the following members.

Constructors
  NameDescription
Public methodDrawingTemplate(PdfBounds)
Initializes a new instance of the DrawingTemplate class with the supplied bounds.
Public methodDrawingTemplate(Double, Double)
Initializes a new instance of the DrawingTemplate class with the supplied width and height.
Top
Properties
  NameDescription
Public propertyBounds
Gets or sets the bounds for the template. All drawing will be limited to the interior of the bounds.
Public propertyColorSpace
Gets or sets the color space preferred by the template. In general, this is used by the PDF viewer when the template is rendered transparently. In such a case, the template will be rendered to this color space before compositing with other elements.
Public propertyDrawingList
Gets the drawing list that represents shapes in the template.
Public propertyICCResourceName
Gets or sets the name of the ICC resource to be used as a ColorSpace if the template should be rendered with a calibrated color space.
Public propertyImportedFonts
If the template was imported from an existing PDF, this will contain a list of fonts that were successfully imported into the resource dictionary.
Public propertyKind
Gets or sets the kind of drawing template. Currently only Normal or Transparency are supported.
Public propertyTransformationMatrix
Gets or sets the transformation matrix that maps the coordinates of elements in the template to the surface on which it's drawn. The default is the identity matrix.
Public propertyTransparencyIsIsolated
Gets or sets a value indicating whether transparency for this template will be isolated from the rest of the backdrop.
Public propertyTransparencyIsKnockout
Gets or sets a value indicating whether transparency is a knockout, meaning that it will be composited with the template's backdrop rather than preceding elements in the template.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
Making a triangle shape.
DrawingTemplate template = new DrawingTemplate(new PdfBounds(0, 0, 100, 100));
PdfPath path = new PdfPath(PdfColorFactory.FromRgb(0, 0, 0), 2, PdfColorFactory.FromRgb(1, 1, 0));
path.MoveTo(2, 2);
path.LineTo(98, 2);
path.LineTo(50, 98);
path.Close();
template.DrawingList.Add(path);
string resourceName = doc.Resources.Templates.Add(template);
PdfTemplateShape shape = new PdfTemplateShape(resourceName, template.Bounds);
page.DrawingList.Add(shape); // this puts the template on the page
See Also