Why are my Units a string?
In older versions of ABCpdf the Units property was a string. So
you might find code of this form.
theDoc.Units = "mm";
theDoc.Units = "mm"
In Version 8 the Units property has been changed to a true
enumeration. This is a safer way of coding as it allows the
compiler to ensure that the values you are using are valid. Your
new code should look like this.
theDoc.Units = UnitType.Mm;
theDoc.Units = UnitType.Mm
The names of the items in the UnitType enumeration are the same
as the values of the strings used in previous versions. So changing
your code should be a simple search and replace operation.
Alternatively if you need to convert between enumerations and
strings automatically you can do so. To convert from a string to an
enumeration use the following code.
UnitType unitType = (UnitType)Enum.Parse(typeof(UnitType), unitString, true);
Dim unitType As UnitType = CType([Enum].Parse(GetType(UnitType), unitString, True), UnitType)
To convert from an enumeration to a string use the following
code.
string unitString = unitType.ToString("G");
Dim unitString As String = unitType.ToString("G")
|