Sample code to add lines and boxes of various widths to a PDF.

Q: Our application is mainly producing new pdf's from scratch.

I don't see an example of how to draw a lines and boxes into a PDF. I
see the fancy transparent circles, but not plain lines and boxes of
various widths. Do you have one?
-----
A: You can use ElementBuilder & ElementWriter to add new content to
new or existing PDF pages.

As a starting point you may want to take a look at ElementBuilder
sample project (http://www.pdftron.com/net/
samplecode.html#ElementBuilder).

For example, the following snippet draws a stroked rectangle (in C#):

...
ElementBuilder builder = new ElementBuilder();
ElementWriter writer = new ElementWriter();
writer.Begin(page); // begin writing to this page

Element element = builder.CreateRect(10, 10, 200, 150);
element.SetPathFill(false);
element.SetPathStroke(true);
element.GetGState().SetStrokeColorSpace(ColorSpace.CreateDeviceRGB());
element.GetGState().SetStrokeColor(new ColorPt(1, 0, 0)); // Red

// Set stroke width.
element.GetGState().SetLineWidth(5);

writer.Writelement(element);

...
// To create a line
builder.PathBegin(); // start building a path
builder.MoveTo(20, 20);
builder.LineTo(600, 600);
element = eb.PathEnd();

element.GetGState().SetStrokeColor(new ColorPt(0, 0, 1)); // Blue

// Set stroke width.
element.GetGState().SetLineWidth(20);
// element.GetGState().SetLineJoin(GState.LineJoin.e_round_join);

writer.Writelement(element);
...

writer.End();