Class

# PDFGraphics

<div class="rst-class">

forsearch

</div>

PDF

<div class="rst-class">

forsearch

</div>

Graphics

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

A Graphics object that can be used for drawing to a `PDFDocument</api/pdf/pdfdocument>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                             | Type                                             | Read-Only | Shared |
|--------------------------------------------------|--------------------------------------------------|-----------|--------|
| `Bold<pdfgraphics.bold>`                         | `Boolean</api/data_types/boolean>`               |           |        |
| `Brush<pdfgraphics.brush>`                       | `GraphicsBrush</api/graphics/graphicsbrush>`     |           |        |
| `CharacterSpacing<pdfgraphics.characterspacing>` | `Integer</api/data_types/integer>`               |           |        |
| `DrawingColor<pdfgraphics.drawingcolor>`         | `Color</api/data_types/color>`                   |           |        |
| `Font<pdfgraphics.font>`                         | `Font</api/graphics/font>`                       |           |        |
| `FontAscent<pdfgraphics.fontascent>`             | `Double</api/data_types/double>`                 | ✓         |        |
| `FontName<pdfgraphics.fontname>`                 | `String</api/data_types/string>`                 |           |        |
| `FontSize<pdfgraphics.fontsize>`                 | `Single</api/data_types/single>`                 |           |        |
| `FontUnit<pdfgraphics.fontunit>`                 | `FontUnits</api/graphics/fontunits>`             |           |        |
| `Height<pdfgraphics.height>`                     | `Double</api/data_types/double>`                 | ✓         |        |
| `Italic<pdfgraphics.italic>`                     | `Boolean</api/data_types/boolean>`               |           |        |
| `LineCap<pdfgraphics.linecap>`                   | `Graphics.LineCapTypes<graphics.linecaptypes>`   |           |        |
| `LineDashOffset<pdfgraphics.linedashoffset>`     | `Double</api/data_types/double>`                 |           |        |
| `LineJoin<pdfgraphics.linejoin>`                 | `Graphics.LineJoinTypes<graphics.linejointypes>` |           |        |
| `MiterLimit<pdfgraphics.miterlimit>`             | `Double</api/data_types/double>`                 |           |        |
| `Outline<pdfgraphics.outline>`                   | `Boolean</api/data_types/boolean>`               |           |        |
| `PenSize<pdfgraphics.pensize>`                   | `Double</api/data_types/double>`                 |           |        |
| `ShadowBrush<pdfgraphics.shadowbrush>`           | `ShadowBrush</api/graphics/shadowbrush>`         |           |        |
| `Transparency<pdfgraphics.transparency>`         | `Double</api/data_types/double>`                 |           |        |
| `Underline<pdfgraphics.underline>`               | `Boolean</api/data_types/boolean>`               |           |        |
| `Width<pdfgraphics.width>`                       | `Double</api/data_types/double>`                 | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                 | Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Returns                                            | Shared |
|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|--------|
| `ClearRectangle<pdfgraphics.clearrectangle>`         | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                         |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `Clip<pdfgraphics.clip>`                             | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                         | `Graphics</api/graphics/graphics>`                 |        |
|                                                      | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                                                                                                                                                                                                             | `Graphics</api/graphics/graphics>`                 |        |
| `ClipToPath<pdfgraphics.cliptopath>`                 | path As `GraphicsPath</api/graphics/graphicspath>`                                                                                                                                                                                                                                                                                                                                                                                                                          |                                                    |        |
| `ClipToRectangle<pdfgraphics.cliptorectangle>`       | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                         |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `DrawCautionIcon<pdfgraphics.drawcautionicon>`       | X As `Double</api/data_types/double>`, Y As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                                |                                                    |        |
| `DrawLine<pdfgraphics.drawline>`                     | x1 As `Double</api/data_types/double>`, y1 As `Double</api/data_types/double>`, x2 As `Double</api/data_types/double>`, y2 As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                              |                                                    |        |
| `DrawNoteIcon<pdfgraphics.drawnoteicon>`             | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                                |                                                    |        |
| `DrawObject<pdfgraphics.drawobject>`                 | object2D As `Object2D</api/graphics/object2d>`, deltaX As `Double</api/data_types/double>` = 0.0, deltaY As `Double</api/data_types/double>` = 0.0                                                                                                                                                                                                                                                                                                                          |                                                    |        |
| `DrawOval<pdfgraphics.drawoval>`                     | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                         |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `DrawPath<pdfgraphics.drawpath>`                     | path As `GraphicsPath</api/graphics/graphicspath>`, autoClose As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                                                                                                                                                                                                                                                                          |                                                    |        |
| `DrawPicture<pdfgraphics.drawpicture>`               | image As `Picture</api/graphics/picture>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, destWidth As `Double</api/data_types/double>` = -10000.0, destHeight As `Double</api/data_types/double>` = -10000.0, sourceX As `Double</api/data_types/double>` = 0.0, sourceY As `Double</api/data_types/double>` = 0.0, sourceWidth As `Double</api/data_types/double>` = -10000.0, sourceHeight As `Double</api/data_types/double>` = -10000.0 |                                                    |        |
| `DrawRectangle<pdfgraphics.drawrectangle>`           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                         |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `DrawRoundRectangle<pdfgraphics.drawroundrectangle>` | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`                                                                                                                                                                                                      |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                          |                                                    |        |
| `DrawStopIcon<pdfgraphics.drawstopicon>`             | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                                |                                                    |        |
| `DrawText<pdfgraphics.drawtext>`                     | str As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>` = 0.0, condense As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                                                                                                                                                       |                                                    |        |
| `DrawTextBlock<pdfgraphics.drawtextblock>`           | value As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `MobileTextControl.Alignments<mobiletextcontrol.alignments>` = `MobileTextControl.Alignments.Left<mobiletextcontrol.alignments>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>`    |                                                    |        |
| `FillOval<pdfgraphics.filloval>`                     | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                         |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `FillPath<pdfgraphics.fillpath>`                     | path As `GraphicsPath</api/graphics/graphicspath>`, autoClose As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                                                                                                                                                                                                                                                                          |                                                    |        |
| `FillRectangle<pdfgraphics.fillrectangle>`           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                         |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `FillRoundRectangle<pdfgraphics.fillroundrectangle>` | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`                                                                                                                                                                                                      |                                                    |        |
|                                                      | r As `Rect</api/graphics/rect>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                          |                                                    |        |
| `LineDash<pdfgraphics.linedash>`                     | `Assigns</api/language/assigns>` values() As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                               |                                                    |        |
|                                                      |                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `Double()</api/data_types/double>`                 |        |
| `NextPage<pdfgraphics.nextpage>`                     |                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
|                                                      | width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                       |                                                    |        |
| `ResetState<pdfgraphics.resetstate>`                 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `RestoreState<pdfgraphics.restorestate>`             |                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `Rotate<pdfgraphics.rotate>`                         | angle As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                                    |        |
| `SaveState<pdfgraphics.savestate>`                   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                    |        |
| `Scale<pdfgraphics.scale>`                           | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                                |                                                    |        |
| `TextBlockSize<pdfgraphics.textblocksize>`           | value As `String</api/data_types/string>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `MobileTextControl.Alignments<mobiletextcontrol.alignments>` = `MobileTextControl.Alignments.Left<mobiletextcontrol.alignments>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                                                                  | `Size</api/graphics/size>`                         |        |
| `TextDirection<pdfgraphics.textdirection>`           | value As `String</api/data_types/string>`                                                                                                                                                                                                                                                                                                                                                                                                                                   | `Graphics.TextDirections<graphics.textdirections>` |        |
| `TextHeight<pdfgraphics.textheight>`                 |                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | `Double</api/data_types/double>`                   |        |
|                                                      | text As `String</api/data_types/string>`, wrapWidth As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                     | `Double</api/data_types/double>`                   |        |
| `TextWidth<pdfgraphics.textwidth>`                   | text As `String</api/data_types/string>`                                                                                                                                                                                                                                                                                                                                                                                                                                    | `Double</api/data_types/double>`                   |        |
| `Translate<pdfgraphics.translate>`                   | x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                                                                                |                                                    |        |

## Property descriptions

<div id="pdfgraphics.bold">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Bold

**Bold** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, text will appear in bold when using `DrawText<graphics.drawtext>`.
>
> Mac apps can only display font styles that are available. You cannot force a font to display in bold or italic if it does not have bold or italic variations available. In this situation, the Bold property will not affect the font.

<div id="pdfgraphics.brush">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Brush

**Brush** As `GraphicsBrush</api/graphics/graphicsbrush>`

> The brush to be used when drawing.

<div id="pdfgraphics.characterspacing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.CharacterSpacing

**CharacterSpacing** As `Integer</api/data_types/integer>`

> This property is expressed as a percentage of spacing between characters. Positive and negative values are accepted.

<div id="pdfgraphics.drawingcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawingColor

**DrawingColor** As `Color</api/data_types/color>`

> The currently selected color for the **Graphics** object. This color is used by the various drawing methods.
>
> This example draws a diagonal line in the current DrawingColor.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.DrawLine(10, 10, 100, 100)
> ```

<div id="pdfgraphics.font">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Font

**Font** As `Font</api/graphics/font>`

> The font used for displaying text.
>
> This in the Paint event draws text using a specific font:
>
> ``` xojo
> g.Font = Font.BoldSystemFont
> g.DrawText("Hello", 5, 20)
> ```
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is only available for Mobile projects. To assign a font in other project types, use the `FontName<graphics.fontname>` property.
>
> </div>

<div id="pdfgraphics.fontascent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FontAscent

**FontAscent** As `Double</api/data_types/double>`

> Returns the ascent of a line of text drawn with the current font.
>
> This property is read-only.
>
> FontAscent is the height of the tallest font letter above the font baseline.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not supported for iOS and Android.
>
> </div>
>
> The following example gets the font ascent of the text that was drawn with DrawText.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.Italic = True
> g.DrawText("Hello world", 10, 10)
> MessageBox(g.FontAscent.ToString)
> ```

<div id="pdfgraphics.fontname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FontName

**FontName** As `String</api/data_types/string>`

> Name of the font used to display the caption or text content.
>
> When used with `PDFDocument</api/pdf/pdfdocument>`, you can assign font names using the `PDFDocument.StandardFontNames<pdfdocument.standardfontnames>` enumeration.
>
> You can enter any font that is installed on the computer or the names of the two metafonts, System and SmallSystem.
>
> The System font is the font used by the system software as its default font. Different operating systems use different default fonts. If the system software supports both a large and small System font, you can also specify the SmallSystem font as your FontName.
>
> On macOS, SmallSystem specifies the smaller system font and may make the control smaller in size as well. On Windows and Linux, SmallSystem is the same as System.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not supported for iOS and Android.
>
> </div>
>
> This code sets the FontName property.
>
> ``` xojo
> g.FontName = "Helvetica"
> ```

<div id="pdfgraphics.fontsize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FontSize

**FontSize** As `Single</api/data_types/single>`

> Point size of the font used to display a caption or text content.
>
> If you enter zero as the FontSize, your app will use the font size that works best for the platform on which it is running.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not supported for iOS and Android.
>
> </div>
>
> This code sets the font size to 16 points.
>
> ``` xojo
> g.FontSize = 16
> ```

<div id="pdfgraphics.fontunit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FontUnit

**FontUnit** As `FontUnits</api/graphics/fontunits>`

> The units in which FontSize is measured.
>
> The FontUnits enumeration values are shown below:
>
> | Value      |
> |------------|
> | Default    |
> | Pixel      |
> | Point      |
> | Inch       |
> | Millimeter |
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is only supported for desktop projects.
>
> </div>
>
> This example sets the units to points using the class constant.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.Italic = True
> g.FontUnit = FontUnits.Point
> g.FontSize = 16
> g.DrawText("Hello world", 10, 10)
> ```

<div id="pdfgraphics.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Height

**Height** As `Double</api/data_types/double>`

> The height in pixels of the parent object, typically a `Canvas</api/user_interface/desktop/desktopcanvas>` control or a `Window</api/user_interface/desktop/desktopwindow>`.
>
> This property is read-only.
>
> For example, if the graphics class object is in a `Canvas</api/user_interface/desktop/desktopcanvas>` control, Height returns the height of the control.
>
> This example in the Canvas.Paint event draws a box the height of the Canvas itself:
>
> ``` xojo
> g.DrawingColor = &c0000ff
> g.FillRectangle(0, 0, g.Width, g.Height)
> ```

<div id="pdfgraphics.italic">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Italic

**Italic** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, text will appear in italic when using `Graphics.DrawText<graphics.drawtext>`.
>
> This example draws "Hello world" in red italic inside a `Canvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> g.DrawingColor = Color.Red
> g.Italic = True
> g.DrawText("Hello world", 10, 10)
> ```

<div id="pdfgraphics.linecap">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.LineCap

**LineCap** As `Graphics.LineCapTypes<graphics.linecaptypes>`

> The way in which the end of the line will be drawn.
>
> Affects only lines drawn when using `DrawPath<graphics.drawpath>`, `GraphicsPath</api/graphics/graphicspath>` and `Object2D</api/graphics/object2d>`.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not supported for Web.
>
> </div>
>
> As an example, in the `DesktopCanvas.Paint<desktopcanvas.paint>` event, set the line cap to round:
>
> ``` xojo
> g.LineCap = Graphics.LineCapTypes.Round
> ```

<div id="pdfgraphics.linedashoffset">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.LineDashOffset

**LineDashOffset** As `Double</api/data_types/double>`

> Specifies the starting point of the dash.
>
> An offset of 0.5 would mean the first dash would start at half size.
>
> Draws a line with 2 unit dashes and 2 unit gaps with the first dash offset by 1.
>
> ``` xojo
> g.LineDash = Array(2.0, 3.0)
> g.LineDashOffset = 1.0
> g.DrawLine(0, 0, g.Width, g.Height)
> ```

<div id="pdfgraphics.linejoin">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.LineJoin

**LineJoin** As `Graphics.LineJoinTypes<graphics.linejointypes>`

> The way in which the end of the line will be drawn when connecting to another line.
>
> Affects only lines drawn when using `DrawPath<graphics.drawpath>`, `GraphicsPath</api/graphics/graphicspath>` and `Object2D</api/graphics/object2d>`. It will also affect how corners are drawn when using `DrawRectangle<graphics.drawrectangle>`.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is not supported for Web.
>
> </div>
>
> In the `DesktopCanvas.Paint<desktopcanvas.paint>`, set the line join to round:
>
> ``` xojo
> g.LineJoin = Graphics.LineJoinTypes.Round
> ```

<div id="pdfgraphics.miterlimit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.MiterLimit

**MiterLimit** As `Double</api/data_types/double>`

> The maximum length of a miter which is the distance between the inner corner and the outer corner where two lines meet.

<div id="pdfgraphics.outline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Outline

**Outline** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, text will appear outlined when using `DrawText<graphics.drawtext>`.
>
> Mac apps can only display font styles that are available. You cannot force a font to display in bold or italic if it does not have bold or italic variations available. In this situation, the bold property will not affect the font.
>
> When using Outline on MacOS and Windows, `Underline<graphics.underline>` is not supported.
>
> GraphicsBrush is ignored when using Outline on iOS.
>
> This example sets the text to Outline.
>
> ``` xojo
> g.Outline = True
> g.DrawText("Hello world", 50, 50)
> ```

<div id="pdfgraphics.pensize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.PenSize

**PenSize** As `Double</api/data_types/double>`

> The size in points used when drawing lines, ovals and rectangles.
>
> This example sets the PenSize to 5 point:
>
> ``` xojo
> g.PenSize = 5
> g.DrawRectangle(150, 10, 100, 100)
> ```

<div id="pdfgraphics.shadowbrush">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.ShadowBrush

**ShadowBrush** As `ShadowBrush</api/graphics/shadowbrush>`

> The brush to be used to draw a shadow on the object being drawn.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is currently supported for Android only.
>
> </div>
>
> This code in the `Paint<desktopcanvas.paint>` event of a `DesktopCanvas</api/user_interface/desktop/desktopcanvas>` draws a rectangle with a shadow:
>
> ``` xojo
> g.ShadowBrush = New ShadowBrush
> g.DrawingColor = Color.Red
> g.FillRectangle(0, 0, 100, 100)
> ```
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> The `color</api/data_types/color>` value of <span class="title-ref">ShadowBrush</span> when used with `DrawPicture<graphics.drawpicture>` is not currently supported on Android.
>
> </div>

<div id="pdfgraphics.transparency">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Transparency

**Transparency** As `Double</api/data_types/double>`

> The amount of transparency that affects all drawing to the **Graphics** object done afterwards. The range is from 0.0 (opaque) to 100.0 (fully transparent). Transparency of the Graphics object can be used to obtain “fading” effects (amongst other uses) by setting the transparency to a value greater than 0.0.
>
> When rendering colors or pictures with alpha channel information, the Transparency property is composited with the alpha channel information. This allows you to perform uniform fading operations easily and efficiently.
>
> On Windows, using the Transparency property only works on `Graphics<picture.graphics>` if the Picture was created with a depth of 32, or is a Picture with an alpha channel. Attempting to use it on other forms of Pictures will result in an `UnsupportedOperationException</api/exceptions/unsupportedoperationexception>`.
>
> Create a picture with a blue rectangle drawn with 50% transparency:
>
> ``` xojo
> Var boxPic As New Picture(100, 100)
> boxPic.Graphics.DrawingColor = &c0000ff00
> boxPic.Graphics.Transparency = 50.0
> boxPic.Graphics.FillRectangle(0, 0, 100, 100)
> ```

<div id="pdfgraphics.underline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Underline

**Underline** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, text will appear underlined when using `DrawText<graphics.drawtext>`.

<div id="pdfgraphics.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Width

**Width** As `Double</api/data_types/double>`

> The width in pixels of the parent object, typically a `Canvas</api/user_interface/desktop/desktopcanvas>` control or a `Window</api/user_interface/desktop/desktopwindow>`.
>
> This property is read-only.
>
> This example in the Canvas.Paint event draws a box the width of the Canvas itself:
>
> ``` xojo
> g.DrawingColor = &c0000ff
> g.FillRectangle(0, 0, g.Width, g.Height)
> ```

## Method descriptions

<div id="pdfgraphics.clearrectangle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.ClearRectangle

**ClearRectangle**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Clears the rectangle described by the parameters passed by filling it with the background color of the parent window (on Windows/Linux) or by clearing the context so that the background comes through (on Mac).
>
> This code clears the entire drawing area:
>
> ``` xojo
> g.ClearRectangle(0, 0, g.Width, g.Height)
> ```

**ClearRectangle**(r As `Rect</api/graphics/rect>`)

> Clears the rectangle described by the `Rect</api/graphics/rect>` parameter *r* passed by filling it with the background color.
>
> This example clears the entire drawing area:
>
> ``` xojo
> Var r As New Rect(0, 0, g.Width, g.Height)
>
> g.ClearRectangle(r)
> ```

<div id="pdfgraphics.clip">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Clip

**Clip**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`) As `Graphics</api/graphics/graphics>`

> Creates a new Graphics object in the parent Graphics object. It has the size and shape defined by the passed parameters.
>
> **Graphics** calls can only draw inside the passed bounds. After creating a clip, you can draw into it, as with any other **Graphics** object. However the drawing will be contained within the clipping, not the parent object. Use this to prevent objects from overlapping with other objects in the parent object. Whatever is drawn to the clipped region is confined to that region.
>
> Clip allows clipping beyond the bottom and right edges of the source. This ensures the resulting graphics object will always be the dimensions requested.
>
> When you are drawing a complex image that involves many calls to Graphics methods, you may want to create non-overlapping regions within the area. You then draw into each "child" area, with the assurance that each drawing will not inadvertently overlap another object.
>
> You create a child region within the parent area with the Clip method. You pass it the top-left corner of the child region and its width and height. It returns a new Graphics object that is the specified region inside the parent area. You can then draw into the child area just as with any other Graphics object. The only difference is that the drawing will be confined to the child area. The coordinates of each call are with respect to the top-left corner of the child area. Here is an example of how this works. This code is in the `DesktopCanvas.Paint<desktopcanvas.paint>`. Two regions at the top of the `Canvas</api/user_interface/desktop/desktopcanvas>` are defined by calls to the Clip method. Subsequent calls to the `Graphics.DrawRectangle<graphics.drawrectangle>` method show where the clippings are. Calls to the `DrawOval<graphics.drawoval>` method draw shapes within the clipped areas. Notice that the first call attempts to draw outside the area. If you were drawing from the parent `Graphics</api/graphics/graphics>` object, the first oval would bump into the second.
>
> ``` xojo
> Var myClip As Graphics = g.Clip(0, 0, 150, 15) 
> Var myClip2 As Graphics = g.Clip(150, 0, 150, 15) 
>
> ' Draw the border of the Canvas in black
> g.DrawingColor = &c000000
> g.DrawRectangle(0, 0, g.Width, g.Height)
>
> ' Draw into the first area in red
> myClip.DrawingColor = &cff0000
> myClip.DrawRectangle(0, 0, myClip.Width, myClip.Height) ' draw the border of the area.
> myClip.DrawOval(0, 0, 200, 15) ' try to draw outside its clip.
>
> ' Draw into the second area in blue
> myClip2.DrawingColor = &c0000ff
> myClip2.DrawRectangle(0, 0, myClip2.Width, myClip2.Height) ' draw the border
> myClip2.DrawOval(0, 0, 150, 15)
> ```

**Clip**(r As `Rect</api/graphics/rect>`) As `Graphics</api/graphics/graphics>`

> Creates a new `Graphics</api/graphics/graphics>` object in the parent `Graphics</api/graphics/graphics>` object. It has the size and shape defined by the passed `Rect</api/graphics/rect>` parameter *r*.
>
> `Graphics</api/graphics/graphics>` calls can only draw inside the passed bounds. After creating a clip, you can draw into it, as with any other `Graphics</api/graphics/graphics>` object. However the drawing will be contained within the clipping, not the parent object. Use this to prevent objects from overlapping with other objects in the parent object. Whatever is drawn to the clipped region is confined to that region.
>
> Clip allows clipping beyond the bottom and right edges of the source. This ensures the resulting `Graphics</api/graphics/graphics>` object will always be the dimensions requested.
>
> When you are drawing a complex image that involves many calls to <span class="title-ref">Graphics</span> methods, you may want to create non-overlapping regions within the area. You then draw into each "child" area, with the assurance that each drawing will not inadvertently overlap another object.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not supported for iOS and Android.
>
> </div>
>
> You create a child region within the parent area with the Clip method. You pass it the top-left corner of the child region and its width and height. It returns a new `Graphics</api/graphics/graphics>` object that is the specified region inside the parent area. You can then draw into the child area just as with any other `Graphics</api/graphics/graphics>` object. The only difference is that the drawing will be confined to the child area. The coordinates of each call are with respect to the top-left corner of the child area.
>
> ``` xojo
> Var r As New Rect(20, 20, 100, 100)
> Var myClip As Graphics = g.Clip(r)
>
> ' The oval is cut off on the right and bottom side as its width/height overlaps the bounds of the clip
> myClip.FillOval(0, 0, 150, 150)
> ```

<div id="pdfgraphics.cliptopath">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.ClipToPath

**ClipToPath**(path As `GraphicsPath</api/graphics/graphicspath>`)

> Clips the drawing to the specified GraphicsPath.
>
> If you need to clear a Clip after it has been used, call `SaveState<graphics.savestate>` before calling ClipToPath and then call `RestoreState<graphics.restorestate>` when you no longer want the clipping in effect.
>
> From within an `MobileCanvas.Paint<mobilecanvas.paint>` event handler:
>
> ``` xojo
> ' Clip to a GraphicsPath
> ' Path is a triangle
> Var p As New GraphicsPath
>
> p.MoveToPoint(0, 0) ' Start location
> p.AddLineToPoint(20, 44)
> p.AddLineToPoint(40, 0)
> p.AddLineToPoint(0, 0)
>
> g.SaveState
> g.ClipToPath(p)
> g.FillOval(0, 0, 50, 50)
> g.RestoreState
> ```

<div id="pdfgraphics.cliptorectangle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.ClipToRectangle

**ClipToRectangle**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Clips the drawing to the specified rectangle.
>
> If you need to clear a Clip after it has been used, call `SaveState<graphics.savestate>` before calling ClipToRectangle and then call `RestoreState<graphics.restorestate>` when you no longer want the clipping in effect.
>
> From within an MobileCanvas.Paint event handler:
>
> ``` xojo
> ' The part of the circle drawn outside the clip area
> ' is not displayed.
> g.SaveState
> g.ClipToRectangle(0, 0, 50, 50)
>
> g.DrawingColor = Color.Blue
> g.FillOval(25, 25, 50, 50)
> g.RestoreState ' removes the clipping rectangle
> ```

**ClipToRectangle**(r As `Rect</api/graphics/rect>`)

> Clips the drawing to the specified rectangle.
>
> If you need to clear a Clip after it has been used, call `SaveState<graphics.savestate>` before calling ClipToRectangle and then call `RestoreState<graphics.restorestate>` when you no longer want the clipping in effect.
>
> From within an `MobileCanvas.Paint<mobilecanvas.paint>` event handler:
>
> ``` xojo
> Var r As New Rect(0, 0, 50, 50)
>
> ' The part of the circle drawn outside the clip area
> ' is not displayed.
> g.SaveState
> g.ClipToRectangle(r)
>
> g.DrawingColor = Color.Blue
> g.FillOval(25, 25, 50, 50)
> g.RestoreState ' removes the clipping rectangle
> ```

<div id="pdfgraphics.drawcautionicon">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawCautionIcon

**DrawCautionIcon**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Draws the operating system's Caution icon at the coordinates specified.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is only supported for desktop projects.
>
> </div>
>
> This code draws the Caution icon at the passed coordinates. The code is in the Paint event.
>
> ``` xojo
> g.DrawCautionIcon(170.0, 120.0)
> ```

<div id="pdfgraphics.drawline">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawLine

**DrawLine**(x1 As `Double</api/data_types/double>`, y1 As `Double</api/data_types/double>`, x2 As `Double</api/data_types/double>`, y2 As `Double</api/data_types/double>`)

> Draws a line from *x1*, *y1* to *x2*, *y2* in the current color. The current color is set with the `DrawingColor<graphics.drawingcolor>` property.

<div id="pdfgraphics.drawnoteicon">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawNoteIcon

**DrawNoteIcon**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Draws the operating system's Note icon at the coordinates specified. *x* and *y* are the coordinates of the top-left corner.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This property is only supported for desktop projects.
>
> </div>
>
> This code draws the Note icon at the passed coordinates. The code is in the Paint event.
>
> ``` xojo
> g.DrawNoteIcon(170.0, 120.0)
> ```

<div id="pdfgraphics.drawobject">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawObject

**DrawObject**(object2D As `Object2D</api/graphics/object2d>`, deltaX As `Double</api/data_types/double>` = 0.0, deltaY As `Double</api/data_types/double>` = 0.0)

> Draws the passed `Object2D</api/graphics/object2d>` object into the `Graphics</api/graphics/graphics>` object. The optional parameters *deltaX* and *deltaY* are offsets from the top-left corner of the `Graphics</api/graphics/graphics>` object to the top-left corner of the *object2D*.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not supported for iOS and Android.
>
> </div>
>
> If *object2D* is an `OvalShape</api/graphics/ovalshape>`, then the offsets are from the top-left corner of the `Graphics</api/graphics/graphics>` object to the center of the `OvalShape</api/graphics/ovalshape>`.
>
> The following method is in the `Paint<desktopwindow.paint>` event of a `DesktopWindow</api/user_interface/desktop/desktopwindow>`. It draws a simple curve. The negative value of ControlY(0) places the control point above the imaginary straight line from x, y to x2, y2.
>
> ``` xojo
> Var c As New CurveShape
>
> c.ControlX(0) = 120
> c.ControlY(0) = -40
> c.Order = 1
> c.X = 10
> c.Y = 100
> c.X2 = 250
> c.Y2 = 100
>
> g.DrawObject(c, c.X, c.Y)
> ```

<div id="pdfgraphics.drawoval">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawOval

**DrawOval**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Draws the outline of an oval in the current color. The current color is set with the `DrawingColor<graphics.drawingcolor>` property.
>
> *x* and *y* are the coordinates of the top-left corner. *width* and *height* specify the size of the oval.
>
> The following example sets the PenSize and draws an oval. The code is in the Paint event of a `Canvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> g.PenSize = 5 
> g.DrawOval(10, 10, 100, 60)
> ```

**DrawOval**(r As `Rect</api/graphics/rect>`)

> Draws the outline of an oval in the current color at the `Rect</api/graphics/rect>` *r* passed. The current color is set with the `DrawingColor<graphics.drawingcolor>` property.
>
> The following example sets the PenSize and draws an oval. The code is in the Paint event of a `DesktopCanvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> Var r As New Rect(10, 10, 100, 60)
>
> g.PenSize = 5 
> g.DrawOval(r)
> ```

<div id="pdfgraphics.drawpath">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawPath

**DrawPath**(path As `GraphicsPath</api/graphics/graphicspath>`, autoClose As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Draws a bezier line along the path designated.
>
> When autoClose is True, the path will be automatically closed so that there are no gaps in it.

<div id="pdfgraphics.drawpicture">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawPicture

**DrawPicture**(image As `Picture</api/graphics/picture>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, destWidth As `Double</api/data_types/double>` = -10000.0, destHeight As `Double</api/data_types/double>` = -10000.0, sourceX As `Double</api/data_types/double>` = 0.0, sourceY As `Double</api/data_types/double>` = 0.0, sourceWidth As `Double</api/data_types/double>` = -10000.0, sourceHeight As `Double</api/data_types/double>` = -10000.0)

> Draws the picture at the specified location. The picture can be shown at full size, cropped, or scaled. All units are pixels.
>
> *x* and *y* are the distances from the top-left corner of the control or window from which the 0,0 point of the image will be drawn. The optional parameters are used to copy a portion of the picture (cropping) and for scaling the picture.
>
> If you are cropping, then *destWidth* and *destHeight* are also required. If you are doing scaling, then all of the optional parameters are required. You scale an image by making the destination width and height different from the source width and height.
>
> The parameters *sourceX*, *sourceY*, *sourceWidth*, and *sourceHeight* describe the portion of the image that will be scaled. *destWidth* and *destHeight* are used to change the scaling of the picture when *sourceWidth* and *sourceHeight* are provided. *sourceX* and *sourceY* default to 0 and are used to determine the upper-left coordinate you wish to copy from.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> Negative values for *destWidth*, *destHeight*, *sourceWidth* and *sourceHeight* are not supported so the behavior is undefined.
>
> </div>
>
> The following example scales an image by 50%. The image, MyImage, has been added to the project. Its size is 600 x 915. Note that the destination width and height are half the original width and height. The code is in the Paint event of a `Canvas</api/user_interface/desktop/desktopcanvas>`. A call to DrawRectangle adds a black border around the `Canvas</api/user_interface/desktop/desktopcanvas>`.
>
> ``` xojo
> g.DrawingColor = &c000000
> g.DrawRectangle(0, 0, Me.Width, Me.Height)
>
> Var scale As Double = 0.50
> g.DrawPicture(MyImage, 0, 0, MyImage.Width * scale, MyImage.Height * scale, 0, 0, MyImage.Width, MyImage.Height)
> ```
>
> The following code crops the image. It copies only the top 150 pixels of the original image at full size:
>
> ``` xojo
> g.DrawPicture(MyImage, 0, 0, 600, 150)
> ```
>
> The following code crops and scales the image. The top half of the image is retained and the *destWidth* and *destHeight* parameters specify a 50% reduction.
>
> ``` xojo
> g.DrawPicture(MyImage, 0, 0, 300, 228, 0, 0, 600, 457)
> ```
>
> If you don't want to scale or crop the image, you can leave off the last six parameters. In this case, it will appear full-size.
>
> ``` xojo
> g.DrawPicture(MyImage, 0, 0)
> ```

<div id="pdfgraphics.drawrectangle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawRectangle

**DrawRectangle**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Draws the outline of a rectangle in the current color. The current color is set with the DrawingColor property.
>
> *x* and *y* are the coordinates of the top-left corner. *width* and *height* specify the size of the rectangle.
>
> This example draws two squares with a 5-point red border.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.PenSize = 5
> g.DrawRectangle(10, 10, 100, 100)
> g.DrawRectangle(130, 10, 100, 100)
> ```

**DrawRectangle**(r As `Rect</api/graphics/rect>`)

> Draws the outline of a rectangle in the current color at the `Rect</api/graphics/rect>` *r* passed. The current color is set with the DrawingColor property.
>
> This example draws two squares with a 5-point red border.
>
> ``` xojo
> Var r1 As New Rect(10, 10, 100, 100)
> Var r2 As New Rect(130, 10, 100, 100)
>
> g.DrawingColor = &cff0000
> g.PenSize = 5
> g.DrawRectangle(r1)
> g.DrawRectangle(r2)
> ```

<div id="pdfgraphics.drawroundrectangle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawRoundRectangle

**DrawRoundRectangle**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

> Draws the outline of a rounded rectangle in the current color. The current color is set with the DrawingColor property.
>
> *x* and *y* are the coordinates of the top-left corner. *width* and *height* specify the size of the round rectangle. *cornerWidth* and *cornerHeight* control the shape of the corners in the horizontal and vertical axes, respectively. They are the distance (in pixels) from the corner at which the arc begins. Setting them to zero results in a rectangle with sharp corners.
>
> This example draws two squares with a 5-pixel red border. The left square sets the arcs to 10 and the right one to 25.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.PenSize = 5
> g.DrawRoundRectangle(10, 10, 100, 100, 10, 10)
> g.DrawRoundRectangle(130, 10, 100, 100, 25, 25)
> ```

**DrawRoundRectangle**(r As `Rect</api/graphics/rect>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

> Draws the outline of a rounded rectangle in the current color at the `Rect</api/graphics/rect>` *r* passed. The current color is set with the DrawingColor property.
>
> *cornerWidth* and *cornerHeight* control the shape of the corners in the horizontal and vertical axes, respectively. They are the distance (in pixels) from the corner at which the arc begins. Setting them to zero results in a rectangle with sharp corners.
>
> This example draws two squares with a 5-pixel red border. The left square sets the arcs to 10 and the right one to 25.
>
> ``` xojo
> Var r1 As New Rect(10, 10, 100, 100)
> Var r2 As New Rect(130, 10, 100, 100)
>
> g.DrawingColor = &cff0000
> g.PenSize = 5
> g.DrawRoundRectangle(r1, 10, 10)
> g.DrawRoundRectangle(r2, 25, 25)
> ```

<div id="pdfgraphics.drawstopicon">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawStopIcon

**DrawStopIcon**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Draws the operating system's Stop icon at the coordinates specified. *x* and *y* are the coordinates of the top-left corner.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is only supported for desktop projects.
>
> </div>
>
> This code draws the Stop icon at the passed coordinates. The code is in the Paint event.
>
> ``` xojo
> g.DrawStopIcon(170, 120)
> ```

<div id="pdfgraphics.drawtext">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawText

**DrawText**(str As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>` = 0.0, condense As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Draws the *str* at the specified location and in the current color. The current color is set with the DrawingColor property.
>
> The *x* parameter specifies the distance from the left of the **Graphics** object in pixels. The *y* parameter specifies the baseline for the text. The optional *width* parameter specifies the width at which *str* should wrap. The *str* will wrap if *width* is provided and *condense* is `False</api/language/false>` (The default is `False</api/language/false>`). If *width* is omitted, then *str* will print on one line, even if the drawing area is too narrow to contain the text. If the optional *condense* property is `True</api/language/true>`, DrawText truncates the text to fit into the space specified by *width* and uses an ellipsis ("...") to indicate that there is additional text that is not shown. The default values of *width* and *condense* are zero and `False</api/language/false>`, respectively. The default behavior is to print the text on one line.
>
> This code draws text in red Helvetica 16-point:
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.FontName = "Helvetica"
> g.FontUnit = FontUnits.Point
> g.FontSize = 16
> g.DrawText("Hello world", 10, 130)
> ```

<div id="pdfgraphics.drawtextblock">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.DrawTextBlock

**DrawTextBlock**(value As `String</api/data_types/string>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `MobileTextControl.Alignments<mobiletextcontrol.alignments>` = `MobileTextControl.Alignments.Left<mobiletextcontrol.alignments>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Draws a block of text.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is currently supported for Android only.
>
> </div>
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> This method is available for Android 10+ only.
>
> </div>
>
> From within an `MobileCanvas.Paint<mobilecanvas.paint>` event handler:
>
> ``` xojo
> Var s As String = "How much wood would a woodchuck chuck if a woodchuck could chuck wood?"
>
> g.FillColor = Color.Blue
> g.DrawTextBlock(s, 0, 10, g.Width, g.Height, MobileTextControl.Alignments.Left, False)
> ```

<div id="pdfgraphics.filloval">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FillOval

**FillOval**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Draws an oval filled with the current color. The current color is set with the DrawingColor property.
>
> *x* and *y* are the coordinates of the top-left corner. *width* and *height* specify the size of the oval.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.FillOval(10, 10, 100, 60)
> ```

**FillOval**(r As `Rect</api/graphics/rect>`)

> Draws an oval filled with the current color at the `Rect</api/graphics/rect>` *r* passed. The current color is set with the DrawingColor property.
>
> ``` xojo
> Var r As New Rect(10, 10, 100, 60)
>
> g.DrawingColor = &cff0000
> g.FillOval(r)
> ```

<div id="pdfgraphics.fillpath">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FillPath

**FillPath**(path As `GraphicsPath</api/graphics/graphicspath>`, autoClose As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Draws a bezier line along the path designated and fills the region with the current `DrawingColor<graphics.drawingcolor>` value.
>
> When autoClose is True, the path will be automatically closed so that there are no gaps in it.

<div id="pdfgraphics.fillrectangle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FillRectangle

**FillRectangle**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Draws a rectangle filled with the current color. The current color is set with the DrawingColor property.
>
> *x* and *y* are the coordinates of the top-left corner. *width* and *height* specify the size of the rectangle.
>
> This example (in the `DesktopCanvas.Paint<desktopcanvas.paint>` control) draws a rectangle with a red interior.
>
> ``` xojo
> g.DrawingColor = &cff0000 ' Red
> g.FillRectangle(10, 10, 100, 60)
> ```

**FillRectangle**(r As `Rect</api/graphics/rect>`)

> Draws a rectangle filled with the current color at the `Rect</api/graphics/rect>` *r* passed. The current color is set with the DrawingColor property.
>
> This example (in the `DesktopCanvas.Paint<desktopcanvas.paint>` event of a `DesktopCanvas</api/user_interface/desktop/desktopcanvas>` control) draws a rectangle with a red interior.
>
> ``` xojo
> Var r As New Rect(10, 10, 100, 60)
>
> g.DrawingColor = &cff0000 ' Red
> g.FillRectangle(r)
> ```

<div id="pdfgraphics.fillroundrectangle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.FillRoundRectangle

**FillRoundRectangle**(x As `Double</api/data_types/double>`, Yy As `Double</api/data_types/double>`, width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

> Draws a rounded rectangle filled with the current color. The current color is set with the DrawingColor property.
>
> *x* and *y* are the coordinates of the top-left corner. *width* and *height* specify the size of the round rectangle. *cornerWidth* and *cornerHeight* control the shape of the corners in the horizontal and vertical axes, respectively. They are the distance (in points) from the corner at which the arc begins. Setting them to zero results in a rectangle with sharp corners.
>
> This example (in the `DesktopCanvas.Paint<desktopcanvas.paint>` control) draws a rounded rectangle with a red fill and 30 pixel rounded corners.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.FillRoundRectangle(10, 10, 100, 60, 30, 30)
> ```

**FillRoundRectangle**(r As `Rect</api/graphics/rect>`, cornerWidth As `Double</api/data_types/double>`, cornerHeight As `Double</api/data_types/double>`)

> Draws a rounded rectangle filled with the current color at the `Rect</api/graphics/rect>` *r* passed. The current color is set with the DrawingColor property.
>
> *cornerWidth* and *cornerHeight* control the shape of the corners in the horizontal and vertical axes, respectively. They are the distance (in points) from the corner at which the arc begins. Setting them to zero results in a rectangle with sharp corners.
>
> This example (in the `DesktopCanvas.Paint<desktopcanvas.paint>` event of a `DesktopCanvas</api/user_interface/desktop/desktopcanvas>` control) draws a rounded rectangle with a red fill and 30 pixel rounded corners.
>
> ``` xojo
> Var r As New Rect(10, 10, 100, 60)
>
> g.DrawingColor = &cff0000
> g.FillRoundRectangle(r, 30, 30)
> ```

<div id="pdfgraphics.linedash">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.LineDash

**LineDash**(`Assigns</api/language/assigns>` values() As `Double</api/data_types/double>`)

> Specifies the on/off dash pattern.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="rst-class">

forsearch

</div>

PDFGraphics.LineDash

**LineDash** As `Double()</api/data_types/double>`

> Passing an array with the values 1.0, 2.0 means a dash of 1 unit with a spacing of 2 units per dash.
>
> Setting LineDash to Nil restores drawing to solid lines.
>
> LineDash affects `DrawLine<graphics.drawline>`, `DrawOval<graphics.drawoval>`, `DrawPath<graphics.drawpath>`, `DrawPath<graphics.drawpath>`, `DrawRectangle<graphics.drawrectangle>`, `DrawRoundRectangle<graphics.drawroundrectangle>` and `DrawText<graphics.drawtext>` (if `Outline<graphics.outline>` = `True</api/language/true>`).
>
> `LineCap<graphics.linecap>` and `LineJoin<graphics.linejoin>` will affect how the dashes are drawn.
>
> Draw a diagonal line with 2 unit dashes and 3 unit gaps
>
> ``` xojo
> g.PenSize = 5
> g.LineDash = Array(2.0, 3.0)
> g.DrawLine(0, 0, g.Width, g.Height)
> ```

<div id="pdfgraphics.nextpage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.NextPage

**NextPage**

> Adds to the PDFDocument a page whose size is defined by the width and height passed. The new page is added after the `CurrentPage<pdfdocument.currentpage>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="rst-class">

forsearch

</div>

PDFGraphics.NextPage

**NextPage**(width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`)

> Adds to the PDFDocument a page whose size is defined by the width and height passed. The new page is added after the `CurrentPage<pdfdocument.currentpage>`.

<div id="pdfgraphics.resetstate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.ResetState

**ResetState**

> Resets the `FontName<graphics.fontname>`, `FontSize<graphics.fontsize>`, `Bold<graphics.bold>`, `Italic<graphics.italic>` and `DrawingColor<graphics.drawingcolor>` properties to their default states.

<div id="pdfgraphics.restorestate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.RestoreState

**RestoreState**

> Restores the `FontName<graphics.fontname>`, `FontSize<graphics.fontsize>`, `Bold<graphics.bold>`, `Italic<graphics.italic>` and `DrawingColor<graphics.drawingcolor>` properties to the values they had when `SaveState<pdfgraphics.savestate>` was last called for this object.

<div id="pdfgraphics.rotate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Rotate

**Rotate**(angle As `Double</api/data_types/double>`)

> Rotates the drawing context at the x and y coordinates by the specified angle (in radians). This only affects subsequent drawing. Any drawing done before the Rotate method called is not rotated.
>
> Use Translate to move the origin.
>
> Support for Rotate in Desktop and Console applications was added in 2021r1.
>
> When used in combination with `Scale<graphics.scale>` and/or `Translate<graphics.translate>` to draw into a `PDFDocument</api/pdf/pdfdocument>`, Rotate may behave differently than it does when drawing to normal `Graphics</api/graphics/graphics>` object because the rotation is being handled by the PDF engine itself.
>
> From within an `MobileCanvas.Paint<mobilecanvas.paint>` event handler:
>
> ``` xojo
> ' Rotate square in center of graphics area
> Const Pi = 3.14159
>
> g.Translate(g.Width / 2, g.Height / 2)
> g.Rotate(Pi / 4) ' 45 degrees or 1/8 of a circle
> g.DrawingColor = Color.Blue
> g.FillRectangle(10, 10, 50, 50)
> ```
>
> ``` xojo
> ' Rotate the entire drawing area around its center
> ' and draw a rectangle
> Const Pi = 3.14159
>
> g.Rotate(Pi / 4, g.Width / 2, g.Height / 2) ' 45 degrees or 1/8 of a circle
> g.DrawingColor = Color.Blue
> g.FillRectangle(g.Width / 2 - 20, g.Height / 2 - 20, 20, 20)
> ```

<div id="pdfgraphics.savestate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.SaveState

**SaveState**

> Saves the `FontName<graphics.fontname>`, `FontSize<graphics.fontsize>`, `Bold<graphics.bold>`, `Italic<graphics.italic>` and `DrawingColor<graphics.drawingcolor>` property values so they can later be restored via `RestoreState<pdfgraphics.restorestate>`.

<div id="pdfgraphics.scale">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Scale

**Scale**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Sets the scale for the graphics context as specified scaleX and scaleY. This only affects subsequent drawing. Any drawing done before the Scale method is called is not scaled.
>
> When used in combination with `Rotate<graphics.rotate>` and/or `Translate<graphics.translate>` to draw into a `PDFDocument</api/pdf/pdfdocument>`, Scale may behave differently than it does when drawing to normal `Graphics</api/graphics/graphics>` object because the scaling is being handled by the PDF engine itself.
>
> From within the `MobileCanvas.Paint<mobilecanvas.paint>` event handler:
>
> ``` xojo
> g.Scale(2.0, 4.0)
> g.DrawingColor = Color.Blue
> g.FillRectangle(10, 10, 10, 10) ' The squares scales to a rectangle
> ```

<div id="pdfgraphics.textblocksize">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.TextBlockSize

**TextBlockSize**(value As `String</api/data_types/string>`, maxWidth As `Double</api/data_types/double>` = -1.0, maxHeight As `Double</api/data_types/double>` = -1.0, alignment As `MobileTextControl.Alignments<mobiletextcontrol.alignments>` = `MobileTextControl.Alignments.Left<mobiletextcontrol.alignments>`, truncateLastLine As `Boolean</api/data_types/boolean>` = `False</api/language/false>`) As `Size</api/graphics/size>`

> Calculates the size of a text as it would appear using DrawTextBlock.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is currently supported for Android only.
>
> </div>
>
> Get the text block size of left-aligned text:
>
> ``` xojo
> Var tbs As Size
> tbs = g.TextBlockSize("Hello, world!", -1, -1, MobileTextControl.Alignments.Left, False)
> ```

<div id="pdfgraphics.textdirection">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.TextDirection

**TextDirection**(value As `String</api/data_types/string>`) As `Graphics.TextDirections<graphics.textdirections>`

> Returns an `Enumeration</api/data_types/enumeration>` that indicates the direction in which the text is written.
>
> This is useful for non-Roman systems, especially Middle-Eastern languages. If you pass an empty string, it returns the system default string direction. If this function is not supported on the user's system, the `Graphics.TextDirections<graphics.textdirections>` value will be Unknown.
>
> This example gets the string direction.
>
> ``` xojo
> If g.TextDirection("Hello world") = Graphics.TextDirections.RightToLeft Then
>   MessageBox("We are on a right to left system.")
> End If
> ```

<div id="pdfgraphics.textheight">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.TextHeight

**TextHeight** As `Double</api/data_types/double>`

> Gets the height of a line of text drawn with the current font.

**TextHeight**(Text As `String</api/data_types/string>`, WrapWidth As `Double</api/data_types/double>`) As `Double</api/data_types/double>`

> Used to calculate the height of a line of text passed (given the wrap width passed) drawn with the current font.
>
> TextHeight is calculated as the maximum height for the font itself and not the actual height of the text. For example, with "a" vs. "A", both return the same TextHeight even though "A" has a greater height than "a".
>
> ``` xojo
> g.FontName = "Helvetica"
> g.FontUnit = FontUnits.Points
> g.FontSize = 32
>
> Var height As Double
> height = g.TextHeight("Hello world", 150)
> ```
>
> This example reports the TextHeight of the current text.
>
> ``` xojo
> g.DrawingColor = &cff0000
> g.Italic = True
> g.DrawText("Hello world", 10, 10)
> MessageBox(g.TextHeight.ToString)
> ```

<div id="pdfgraphics.textwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.TextWidth

**TextWidth**(text As `String</api/data_types/string>`) As `Double</api/data_types/double>`

> Returns as a `Double</api/data_types/double>` the width of *text* in points, based on the current text properties of the `Graphics</api/graphics/graphics>` object.
>
> To be precise, `Graphics.TextWidth<graphics.textwidth>` returns the width of the string's baseline, which is to say that it returns the position that the next character would be drawn at, if the string were to be extended. For example, if `Graphics.Bold<graphics.bold>` is `True</api/language/true>`, then each character would have a larger width when drawn, so `Graphics.TextWidth<graphics.textwidth>` will return a larger value than otherwise. On the other hand, if `Graphics.Italic<graphics.italic>` is `True</api/language/true>`, then the last character of the text would lean to the right when drawn, increasing the visual width of the text slightly. However, the baseline of the rendered string would not have changed, so `Graphics.TextWidth<graphics.textwidth>` will generally not return a different value in this case.
>
> `Graphics.TextWidth<graphics.textwidth>` does not handle multiple lines in the way that one might expect. Essentially, the multi-line nature of the text is ignored, and newline sequences are treated as if they were space characters. For example, it returns the same value for the text "A B" as for the text "A"+EndOfLine+"B". To take multiple lines into account, you'll need to `String.Split<string.split>` the text into multiple lines yourself, and calculate the width of each line separately, handling leading or trailing whitespace in whatever way makes sense for your situation.
>
> This example creates a `Picture</api/graphics/picture>` and uses its Graphics object to calculate the TextWidth and display it in a TextField on a window:
>
> ``` xojo
> Var p As New Picture(100, 100, 32)
> Var d As Double = p.Graphics.TextWidth("Hello World!")
>
> TextField1.Text = d.ToString
> ```

<div id="pdfgraphics.translate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

PDFGraphics.Translate

**Translate**(x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Translates the origin point by the specified *x* and *y* values. Useful with Rotate.
>
> Support for Translate in Desktop and Console applications was added in 2021r1.
>
> When used in combination with `Rotate<graphics.rotate>` and/or `Scale<graphics.scale>` to draw into a `PDFDocument</api/pdf/pdfdocument>`, Translate may behave differently than it does when drawing to normal `Graphics</api/graphics/graphics>` object because the translation is being handled by the PDF engine itself.
>
> From within an `MobileCanvas.Paint<mobilecanvas.paint>` event handler:
>
> ``` xojo
> ' Rotate square in center of graphics area
> Const Pi = 3.14159
>
> g.Translate(g.Width / 2, g.Height / 2)
> g.Rotate(Pi / 4) ' 45 degrees or 1/8 of a circle
> g.DrawingColor = Color.Blue
> g.FillRectangle(10, 10, 50, 50)
> ```

## Notes

<span class="title-ref">PDFGraphics</span> is a subset of the methods and properties available in the `Graphics</api/graphics/graphics>` class. Because <span class="title-ref">PDFGraphics</span> is a subclass of `Graphics</api/graphics/graphics>`, you can pass a <span class="title-ref">PDFGraphics</span> object to methods that expect a `Graphics</api/graphics/graphics>` object.

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Graphics</api/graphics/graphics>` parent class; `Graphics</api/graphics/graphics>` and `PDFDocument</api/pdf/pdfdocument>` classes

</div>
