## Tools for Viewing, Printing, Markup and Conversion

Software Companions XML Markup Format Description
ViewCompanion 11
scViewerX 6

The Software Companions XML markup format can be easily created by a third-party application or by using a text editor.
With this format you can create easily your own custom markup files from scratch.
In ViewCompanion you can use XML formatted markup files in combination with the command line parameter /lxml during command line conversion and printing. You may also load XML markup files from inside the application by using the "Add From File" menu command.
If you're using scViewerX you can load XML markup files using the MarkupAddFromFile method. To load XML data already in memory you can use MarkupCreateFromXML.
The default extension for a Software Companions XML Markup file is .scmx, but .xml may also be used.

File Format Specification

```<?xml version="1.0" encoding="UTF-8"?>
<SCMarkupFormat>
```

Only UTF-8 encoding is currently supported.
The header and elements section must then follow. A layers section can optionally be included.
A sample xml markup file is shown below:

```<?xml version="1.0" encoding="UTF-8"?>
<SCMarkupFormat>
<Unit>mm</Unit>
<Layers>
<layer name="Markup Layer 1" color="#0000FF" enabled='1'/>
<layer name="Markup Layer Two" color="#00ff00" enabled='1'/>
</Layers>
<Elements>
<Element>
<type>Text</type>
<layer>0</layer>
<page>0</page>
<insertx>10</insertx>
<inserty>30</inserty>
<user>Peter</user>
<color>#FF0000</color>
<text>This is a text</text>
<rotation>45</rotation>
<font height='10' facename='Times New Roman'/>
</Element>
</Elements>
</SCMarkupFormat>
```

This xml markup file defines a single text element. The insert position is 10mm from left and 30 mm from bottom of the drawing. The markup coordinate system origin is always the lower left corner of the drawing. The coordinates can be given in millimeters, inches or native (1016 DPI) values. All color values are coded as red, green and blue intensities in hexadecimal notation (HTML standard - #RRGGBB).
The Layers section defines two layers.

This section contains settings that are common for all markup elements.
The supported entries in this section are:

Unit
Accepted values:
 Value Description mm Coordinates and sizes are given in millimeters. inch Coordinates and sizes are given in inches. mil Coordinates and sizes are given in 1/1000 inch. native Coordinates and sizes are given in native coordinates (1016 DPI).

Layers Section

This section contains layer definitions. Each layer definition can have three different attributes.
The first defined layer will have index 0, the next one 1, etc. The layer index is used when elements are defined.

The description of each attribute is given below:
 Attribute Name Description Name Name to use for the layer. Color Default color to use for elements placed on this layer. Enabled Enter a value different from 0 to make the layer visible.

Sample entry:
<Layer name="Markup Layer 1" color="#0000FF" enabled='1'/>
This entry will create a layer that is named "Markup Layer 1", with default color blue and it will be visible/enabled.

Elements Section

This section contains one or more Element entries. See description of available Element entries below.

Element Section

Each element section defines a new markup element. Some of the entry keywords are common for all element types, and some are type specific.
The following table lists the keywords that are common for all elements:

 Keyword Description type Markup element type keyword. The following element types are available: Arrow Circle Ellipse Erase Polygonal Area Erase Rectangular Area Eraser Line Picture Polygon Polyline Rectangle Revision Cloud Rounded Rectangle Rubber Stamp Symbol Text handle An unique element numerical id. hyperlink Link to a document or an URL. layer Layer index to use for the markup element. page Page index where the markup element will be placed. Page indexes are zero based. transparent If defined, the markup element will be transparent. user Name of the user that have created the element (optional).

Arrow Element

The arrow element requires the following keywords, in addition to the common keywords:

 Keyword Description points This section contains one point entry for each point in the arrow polyline. Each point is defined with an x and y attribute. See the xml definition below for an example on how to describe point entries. color Define draw color to use for the element. arrowhead Define type of arrow header to use. Supported arrow types: 0: open, 1: closed, 2: filled. arrowsize Define size of arrow header. linewidth Define width of the arrow lines. The width is defined using the active unit. This entry is optional.

 Sample arrow element xml definition: ``` Arrow 0 0 #FF0000 2 5 0.3 ``` The xml data to the left will create the following arrow:

Circle Element

The circle element requires the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created circle. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: Note: You may define the circle using centerx, centery and radius keywords instead of boundary. centerx Horizontal center coordinate of circle. centery Vertical center coordinate of circle. fillcolor Define fill color to use for the element. color Define outline color to use for the element. linewidth Define width of the outline. The width is defined using the active unit. This entry is optional. linestyle Define line style to use for the outline. This entry is optional. fillstyle Define fill style to use for the element. This entry is optional. radius Radius of circle.

 Sample circle element xml definition using the boundary specification: ``` Circle 0 0 Paul #FF0000 #FFA0A0 1 1.0 ``` Sample circle element xml definition using center and radius specification: ``` Circle 130 60 50 0 0 Paul #FF0000 #FFA0A0 1 1.0 ``` Both xml definitions to the left will create the following circle:

Ellipse Element

The ellipse element uses the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created ellipse. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: fillcolor Define fill color to use for the element. color Define outline color to use for the element. linewidth Define width of the outline. The width is defined using the active unit. This entry is optional. linestyle Define line style to use for the outline. This entry is optional. fillstyle Define fill style to use for the element. This entry is optional.

 Sample ellipse element xml definition: ``` Ellipse 0 0 Paul #FF0000 #FFCCFF 1 1.0 ``` The xml data to the left will create the following ellipse:

Erase Polygonal Area

Define an area to hide (erase) using a polygon. This feature is also known as wipeout.
The erase polygonal area element requires the following keywords, in addition to the common keywords:

 Keyword Description points This section contains one point entry for each point in the polygon. Each point is defined with an x and y attribute. See the xml definition below for an example on how to describe point entries.

 Sample erase polygonal area element xml definition: ``` Erase Polygonal Area 0 0 Bill ``` The xml data to the left will erase the polygonal area as shown below when used for sample file compare_revA.plt: Before xml markup is loaded. After xml markup is loaded.

Erase Rectangular Area

Define an area to hide (erase) using a rectangle. This feature is also known as wipeout.
The erase rectangular area element requires the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created rectangle. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry:

 Sample erase rectangular area element xml definition: ``` Erase Rectangular Area 0 0 ``` The xml data to the left will erase the rectangular area as shown below when used for sample file compare_revA.plt: Before xml markup is loaded. After xml markup is loaded.

Eraser

Define a polyline that will erase/hide drawing contents. This is known as the freehand eraser in ViewCompanion.
The polyline defined will be drawn with the current background color and with the width defined by the linewidth setting.
The eraser element requires the following keywords, in addition to the common keywords:

 Keyword Description points This section contains one point entry for each point in the polyline. Each point is defined with an x and y attribute. See the xml definition below for an example on how to describe point entries.

 Sample eraser element xml definition: ``` Eraser 0 0 5.0 ```

Line Element

The line element uses the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created line. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: . The line will be drawn between x1,y1 and x2,y2. color Define line color to use for the element. linewidth Define the width of the line. The width is defined using the active unit. This entry is optional. linestyle Define line style to use for the line. This entry is optional.

 Sample line element xml definition: ``` Line 0 0 Bill #00FF00 1.0 0 ``` The xml data to the left will create the following line:

Picture Element

The picture element requires the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created line. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: .The picture will be scaled to fit the rectangle defined by x1,y1 and x2,y2. filename Full path to the picture file that will be added as markup.Please note that either double back slash (\\), or a single slash (/) must be used.

 Sample picture element xml definition: ``` Picture 0 0 D:\\temp\\logo.jpg Bill ``` The xml data to the left will add the following picture:

Polygon Element

The polygon element requires the following keywords, in addition to the common keywords:

 Keyword Description points This section contains one point entry for each point in the polygon. Each point is defined with an x and y attribute. See the polygon element definition below for an example on how to describe point entries. color Define line color to use for the element. fillcolor Define fill color to use for the element. color Define outline color to use for the element. linewidth Define width of the outline. The width is defined using the active unit. This entry is optional. fillstyle Define fill style to use for the element. This entry is optional.

 Sample polygon element xml definition: ``` Polygon 0 0 Bill #FF0000 #CCFFCC 0 1 ``` The xml data to the left will create the following 4-point polygon:

Polyline Element

The polyline element requires the following keywords, in addition to the common keywords:

 Keyword Description points This section contains one point entry for each point in the polyline. Each point is defined with an x and y attribute. See the polyline element definition below for an example on how to describe point entries. color Define line color to use for the element. fillcolor Define fill color to use for the element. color Define outline color to use for the element. linewidth Define width of the polyline. The width is defined using the active unit. This entry is optional. linestyle Define line style to use for the outline. This entry is optional.

 Sample polyline element xml definition:``` Polyline 0 0 Bill #FF0000 0.5 ``` The xml data to the left will create the following 4-point polyline:

Rectangle Element

The rectangle element requires the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created rectangle. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: fillcolor Define fill color to use for the element. color Define outline color to use for the element. linewidth Define width of the outline. The width is defined using the active unit. This entry is optional. fillstyle Define fill style to use for the element. This entry is optional.

 Sample rectangle element xml definition: ``` Rectangle 0 0 Ben #0000FF #00CCFF 1 0 ``` The xml data to the left will create the following rectangle:

Revision Cloud Element

The revision cloud element requires the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created revision cloud. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: fillcolor Define fill color to use for the element. color Define outline color to use for the element. linewidth Define width of the outline. The width is defined using the active unit. This entry is optional. fillstyle Define fill style to use for the element. This entry is optional.

 Sample revision cloud element definition: ``` Revision Cloud 0 0 Mary #FF00FF 0 3 ``` The xml data to the left will create the following revision cloud:

Rounded Rectangle Element

The rounded rectangle element requires the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created rounded rectangle. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: fillcolor Define fill color to use for the element. color Define outline color to use for the element. linewidth Define width of the outline. The width is defined using the active unit. This entry is optional. fillstyle Define fill style to use for the element. This entry is optional.

 Sample rectangle element xml definition: ``` Rounded Rectangle 0 0 Ben #FF0000 #CCCCCC 1 2 ``` The xml data to the left will create the following element:

Rubber Stamp Element

There are two ways to define a stamp element in XML. The first rubber stamp element definition method uses the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created rubber stamp. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: backcolor Define stamp background color. textcolor Define color to use for the stamp text. text Stamp text. font Define font to use for the stamp text.The font is defined using several different attributes, each of them correspond to the Windows LOGFONT definition.The following font attributes are supported: height - Same as LOGFONT lfHeight. Please note that this value will be recalculated. orientation - Same as LOGFONT lfOrientation. weight - Same as LOGFONT lfWeight. italic - Same as LOGFONT lfItalic. underline - Same as LOGFONT lfUnderline. strikeout - Same as LOGFONT lfStrikeout. charset - Same as LOGFONT lfCharset. outprecision - Same as LOGFONT lfOutPrecision. clipprecision - Same as LOGFONT lfClipPrecision. quality - Same as LOGFONT lfQuality. pitch - Same as LOGFONT lfPitchAndFamily. facename - Same as LOGFONT lfFaceName. Sample font definition: linewidth Define width of the outline. The width is defined using the active unit. This entry is optional.

 Sample rubber stamp element definition: ``` Rubber Stamp 0 0 Bob Draft #FF0000 #FFCCCC ``` The xml data to the left will create the following rubber stamp:

The second method is using percentage values to make it easier to center a stamp on a document page.
This element definition uses the following keywords, in addition to the common keywords:

 Keyword Description center Define center point for the created rubber stamp in percentage of document extents. The center point is defined using two attributes and these are named x and y. Sample definition:
- this will place the stamp centered on the document page. size Set the extents for the rubber stamp in percentage of current document page extents. The extents are defined using two attributes named w and h. Sample definition: - this will create a stamp with width equal to 20% of document page width, and the height will be 10% of document page height. rotation Define stamp rotation in degrees. backcolor Define the stamp background color. textcolor Define the color to use for the stamp text. text Stamp text string. font Define font to use for the stamp text.The font is defined using several different attributes, each of them correspond to the Windows LOGFONT definition.The following font attributes are supported: height - This value will be recalculated based on given stamp width and height. orientation - Same as LOGFONT lfOrientation. weight - Same as LOGFONT lfWeight. italic - Same as LOGFONT lfItalic. underline - Same as LOGFONT lfUnderline. strikeout - Same as LOGFONT lfStrikeout. charset - Same as LOGFONT lfCharset. outprecision - Same as LOGFONT lfOutPrecision. clipprecision - Same as LOGFONT lfClipPrecision. quality - Same as LOGFONT lfQuality. pitch - Same as LOGFONT lfPitchAndFamily. facename - Same as LOGFONT lfFaceName. Sample font definition: linewidth Define width of the outline. The width is defined using the active unit. This entry is optional.

 Sample rubber stamp element definition using percentage values: ``` Rubber Stamp 0 0
Bob Draft 45 #FF0000 #FFCCCC ``` This XML description will add a stamp with it's center at document center (50% of the document width, and 50% of the document height). The stamps width will be 20% of document width, and the height will be 10% of the document height. The stamp rotation is set to 45 degrees.

Symbol Markup Element

The symbol element requires the following keywords, in addition to the common keywords:

 Keyword Description boundary Define boundary for the created symbol. The boundary is defined using four attributes.These attributes are named: x1, y1, x2 and y2. Sample boundary entry: symbollibrary The name of the symbol library to use. symbolname The name of the symbol to use.

 Sample symbol element definition (the Sample library is included in the ViewCompanion installation): ``` Symbol 0 0 Kim Sample Copyright ``` The xml data to the left will add the following symbol to the file:

Text Markup Element

There are two ways to define a text element in XML. The first text element definition uses the following keywords, in addition to the common keywords:

 Keyword Description insertx Text x insert coordinate. Coordinate is defined using the active unit. inserty Text y insert coordinate. Coordinate is defined using the active unit. rotation Text rotation in degrees. textcolor Define color to use for the text. text Text. font Define font to use for the text.The font is defined using several different attributes, each of them correspond to the Windows LOGFONT definition.The following font attributes are supported: height - Same as LOGFONT lfHeight. width - Samer as LOGFONT lfWidth. orientation - Same as LOGFONT lfOrientation. weight - Same as LOGFONT lfWeight. italic - Same as LOGFONT lfItalic. underline - Same as LOGFONT lfUnderline. strikeout - Same as LOGFONT lfStrikeout. charset - Same as LOGFONT lfCharset. outprecision - Same as LOGFONT lfOutPrecision. clipprecision - Same as LOGFONT lfClipPrecision. quality - Same as LOGFONT lfQuality. pitch - Same as LOGFONT lfPitchAndFamily. facename - Same as LOGFONT lfFaceName. Sample font definition:

 Sample text element definition: ``` Text 0 0 Bob 10 30 #FF0000 This is a text 45 ``` The xml data to the left will create the following text element:

The second way is using percentage values instead of coordinates, to make it easier to center a text on a document page.
This second way of definition uses the following keywords, in addition to the common keywords:

 Keyword Description center Text center coordinate. Text center coordinate is defined by setting x and y to a percentage of the document extents. Sample usage:
will add the text centered at document center. rotation Text rotation in degrees. textcolor Define color to use for the text. text The text string to display. font Define font to use for the text.The font is defined using several different attributes, each of them correspond to the Windows LOGFONT definition.The following font attributes are supported: height - Same as LOGFONT lfHeight. The height can be defined using percent of document page height. width - Samer as LOGFONT lfWidth. orientation - Same as LOGFONT lfOrientation. weight - Same as LOGFONT lfWeight. italic - Same as LOGFONT lfItalic. underline - Same as LOGFONT lfUnderline. strikeout - Same as LOGFONT lfStrikeout. charset - Same as LOGFONT lfCharset. outprecision - Same as LOGFONT lfOutPrecision. clipprecision - Same as LOGFONT lfClipPrecision. quality - Same as LOGFONT lfQuality. pitch - Same as LOGFONT lfPitchAndFamily. facename - Same as LOGFONT lfFaceName. Sample font definition:
 The insertx and inserty keywords are replaced by the center keyword. Example of how to create a text using percentage values to define text origin and height: ``` Text 0 0 Frank
#FF0000 This is a text 45 ``` This description will add a red text element with it's center at document center (50% of the document width, and 50% of the document height). The text height is set to be 10% of the document height.

Line and Fill Style Values

Linestyle

The linestyle can be defined using one of the following values:
0 Solid line.
1 Dashed line.
2 Dotted line.
3 Dash-dot line.
4 Dash-dot-dot line.

Fillstyle

The fillstyle can have one the following values:
0 Outlined (no fill).
1 Solid fill.
2 Horizontal hatch.
3 Vertical hatch.
4 Crosshatched.
5 Diagonal hatch.
6 Diagonal cross hatching.