# Drawing Text in PDF

Learn how to draw text using Wijmo's PDF module in this tutorial

## Content


Each of the drawing areas provide __drawText__ method to draw text. It takes the following arguments:

* The text to draw
* The X-coordinate of the point to draw the text at (optional)
* The Y-coordinate of the point to draw the text at (optional)
* The text drawing options (optional)

Example
```javascript
doc.drawText("Lorem.");
// or
doc.drawText("Ipsum.", 0, 30);
// or
doc.drawText("Dolor.", null)
```

## Current text coordinates
There is a concept of the current text coordinates, represented by the drawing area's *x* and *y* properties. These coordinates are used by the __drawText__ method if positioning arguments are not defined. Each call to the __drawText__ method updates the current text coordinates internally (even if the coordinates were passed into the method explicitly), so, any subsequent text is placed below the previous one.

Use the drawing area's __moveDown__ and __moveUp__ methods to move the Y-coordinate lower or upper with a given number of lines (default = 1).

## Wrapping and Clipping
The text is drawn within a rectangular area defined as follows:

* The *x* and *y* arguments determine the upper-left corner of the area. If omitted, then the current text coordinates are used instead.
* The __width__ and __height__ properties determine the size of the area. If __width__ is omitted, then the area will be limited horizontally by right margin of the page. If __height__ is omitted, then the area will be limited vertically by the bottom edge of a body section. Use Infinity to indicate that the area has an infinite size in that direction.

The text is wrapped and clipped automatically within the area. If __height__ is not defined, then the text will be extended to a new page automatically if it exceeds the bottom edge of the body section.

## Alignment
Use the __align__ property to determine how text should be aligned horizontally within the area. The following alignment methods are supported: left (default), center, right, justify.

For example, the following code draws a text within a 300x100 rectangle using current text coordinates and aligns it to the right.
```javascript
doc.drawText("Lorem", null, null, {
    height: 100,
    width: 300,
    align: wijmo.pdf.PdfTextHorizontalAlign.Right
});
```