Unit Structure

Unit is used to convert a wide variety of units to points, which is the unit used in PDF.

Namespace:  TallComponents.PDF
Assembly:  TallComponents.PDF.Kit (in TallComponents.PDF.Kit.dll) Version: 5.0.18.0
Syntax
public struct Unit

The Unit type exposes the following members.

Constructors
  NameDescription
Public methodUnit(Double)
Create a Unit from a value. The value is assumed to be in Points.
Public methodUnit(Double, UnitType)
Create a Unit from a value and a UnitType
Top
Properties
  NameDescription
Public propertyIsRelative
This Unit is a relative value. True if this Unit is a percentage.
Public propertyPoints
Return the value of this Unit in points.
Top
Methods
  NameDescription
Public methodEquals
Determines whether two Object instances are equal.
(Overrides ValueTypeEquals(Object).)
Public methodStatic memberCode exampleFromPixels
Create a unit from pixels and a resolution. Useful for working with images.
Public methodGetHashCode
Calculates a hash for this type.
(Overrides ValueType.)
Public methodGetType (Inherited from Object.)
Public methodStatic memberParse
Create a unit from a string.
Public methodStatic memberToPoints
Convert a unit string to points
Public methodCode exampleToString
Returns the value of the Unit as a formatted string in points.
(Overrides ValueType.)
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Compares two Unit objects for equality.
Public operatorStatic member(Double to Unit)
Implicit conversion from double. This allows you to assign a double to any variable or property of type Unit without constructors or casting.
Public operatorStatic member(String to Unit)
Implicit conversion from string. This allows you to assign a sized string to any variable or property of type Unit without constructors or casting.
Public operatorStatic member(Unit to Double)
Implicit conversion to double. The value is expressed in points.
Public operatorStatic memberInequality
Compares two Unit objects for inequality.
Top
Remarks
A point in PDF is exactly 1/72 inch. This is also known as a PostScript point. This class converts all units to PostScript points.
Examples

C#

myTable.PreferredWidth = Unit.Parse("50mm");
See Also