Skip to content

3.5 Draw Two Lines of Heading

OgreTransporter edited this page Mar 2, 2020 · 1 revision

The DrawTwoLinesOfHeading method draws two heading lines at the center of the page. The first line is drawing text with outline special effect.

// Draw heading
private void DrawTwoLinesOfHeading()
{
    // page heading
    // Arguments: Font: ArialBold, size: 36 points, Position: X = 4.25", Y = 9.5"
    // Text Justify: Center (text center will be at X position)
    // Stoking color: R=128, G=0, B=255 (text outline)
    // Nonstroking color: R=255, G=0, B=128 (text body)
    Contents.DrawText(Comic, 40.0, 4.25, 9.25, TextJustify.Center, 0.02, Color.FromArgb(128, 0, 255), Color.FromArgb(255, 0, 128), "PDF FILE WRITER");

    // save graphics state
    Contents.SaveGraphicsState();

    // change nonstroking (fill) color to purple
    Contents.SetColorNonStroking(Color.Purple);

    // Draw second line of heading text
    // arguments: Handwriting font, Font size 30 point, Position X=4.25", Y=9.0"
    // Text Justify: Center (text center will be at X position)
    Contents.DrawText(Comic, 30.0, 4.25, 8.75, TextJustify.Center, "Example");

    // restore graphics sate (non stroking color will be restored to default)
    Contents.RestoreGraphicsState();
    return;
}
Clone this wiki locally