# Document
Class
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| FontStyles | Normal <br > Bold <br > Italic <br > BoldItalic | Supported font styles for drawing text. |
| Formats | A0 <br > A1 <br > A2 <br > A3 <br > A4 <br > A5 <br > A6 <br > A7 <br > A8 <br > A9 <br > A10 <br > B0 <br > B1 <br > B2 <br > B3 <br > B4 <br > B5 <br > B6 <br > B7 <br > B8 <br > B9 <br > B10 <br > C0 <br > C1 <br > C2 <br > C3 <br > C4 <br > C5 <br > C6 <br > C7 <br > C8 <br > C9 <br > C10 <br > CreditCard <br > DriversLicense <br > GovernmentLetter <br > JuniorLegal <br > Ledger <br > Legal <br > Letter <br > Tabloid | Support document size formats. |
| LineCapStyles | Miter <br > Rounded <br > Square | Determines how the ends of vector lines are drawn. |
| Orientations | Portrait <br > Landscape | Supported document rendering orientations. |
| Units | Points <br > Pixels <br > Centimeters <br > Millimeters <br > Inches | Supported page measurement units. Points is the recommended unit. |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| AddAnnotation | annotation as Annotation | (None) | Adds an annotation object to the document. |
| AddFont | file as FolderItem <br> name as String <br> style as String = "normal" <br> weight as String = "normal" | (None) | Adds a font file to the document. |
| AddFont | url as String <br> name as String <br> style as String = "normal" <br> weight as String = "normal" | (None) | Adds a font to the document by URL. This may fail depending on CORS policy. Such failures are not a bug in GraffitiPDF. When in doubt, use TTF files with the FolderItem method. |
| AddFont | file as WebFile <br> name as String <br> style as String = "normal" <br> weight as String = "normal" | (None) | Adds a font to the document using a WebFile as the source object. |
| AddFormElement | element as GraffitiPDF.Forms.FormElement | (None) | Adds an AcroForms object to the document. |
| AddPage | (None) | (None) | Adds a new page to the document using the global measurements set when creating the document. |
| AddPage | width as Double <br> height as Double <br> orientation as Orientations | (None) | Adds a page to the document with a custom set of measurements. |
| AddPage | backdrop as Picture | (None) | Adds a new page to the document using the global measurements set when creating the document, and applies the backdrop parameter value Picture as the background of the page. |
| CharacterSpacing | assigns value as Double | (None) | Determines the spacing between characters when drawing text. |
| Constructor | (None) | (None) | Creates a new instance of the class. |
| CreatePageSurface | (None) | Picture | Creates a Xojo Picture objec tthat can be drawn to and passed to AddPage to create a page with a raster backdrop. |
| DrawBezier | x2 as Double <br> y2 as Double <br> x3 as Double <br> y3 as Double <br> x4 as Double <br> y4 as Double | (None) | Draws a bezier curve to the current page at the current coordinates. |
| DrawCircle | radius as Double | (None) | Draws a circle to the current page at the current coordinates. |
| DrawEllipse | radiusX as Double <br> radiusY as Double | (None) | Draws an ellipse to the current page at the current coordinates. |
| DrawHTML | htmlObject as GraffitiPDF.HTML | (None) | Draws an HTML object to the current page. This may fail under some scenarios and is considered experimental. Bug reports about this functionality may not be resolved. |
| DrawImage | image as Image | (None) | Draws an image to the current page at the current coordinates. |
| DrawLine | toX as Double <br> toY as Double | (None) | Draws a line to the current page at the current coordinates. |
| DrawPath | path as Path | (None) | Draws a path to the current page at the current coordinates. |
| DrawRectangle | width as Double <br> height as Double | (None) | Draws a rectangle to the current page at the current coordinates. |
| DrawRoundedRectangle | width as Double <br> height as Double <br> cornerRadiusX as Double <br> cornerRadiusY as Double | (None) | Draws a rounded rectangle to the current page at the current coordinates. |
| DrawSVG | svgObject as GraffitiPDF.SVG | (None) | Draws an SVG object to the current page. This may fail under some scenarios and is considered experimental. Bug reports about this functionality may not be resolved. |
| DrawTable | table as GraffitiPDF.Tables.Instance <br> updateY as Boolean = True | (None) | Draws a table to the current page at the current coordinates. |
| DrawText | textObject as TextContent <br> updateX as Boolean = False <br> updateY as Boolean = False | (None) | Draws a text object to the current page at the current coordinates. |
| DrawTriangle | x2 as Double <br> y2 as Double <br> x3 as Double <br> y3 as Double | (None) | Draws a triangle to the current page at the current coordinates. |
| EnableClipping | (None) | (None) | Enables clipping of elements. Should follow a call to SaveState and a vector draw operation. Call RestoreState to exit clipping mode. |
| FillCircle | radius as Double | (None) | Draws a filled circle to the current page at the current coordinates. |
| FillColor | assigns value as Color | (None) | Sets the current vector fill color of the document. |
| FillEllipse | radiusX as Double <br> radiusY as Double | (None) | Draws a filled ellipse to the current page at the current coordinates. |
| FillOpacity | assigns value as Double | (None) | Sets the current vector draw fill opacity. |
| FillPath | path as Path | (None) | Draws a filled path to the document. |
| FillRectangle | width as Double <br> height as Double | (None) | Draws a filled Rectangle to the current page at the current coordinates. |
| FillRoundedRectangle | width as Double <br> height as Double <br> cornerRadiusX as Double <br> cornerRadiusY as Double | (None) | Draws a filled rounded rectangle to the current page at the current coordinates. |
| FillTriangle | x2 as Double <br> y2 as Double <br> x3 as Double <br> y3 as Double | (None) | Draws a filled triangle to the current page at the current coordinates. |
| FontName | assigns value as String | (None) | Sets the document’s currently used font name. |
| FontSize | assigns value as Double | (None) | Sets the document’s currently used font size. |
| FontStyle | assigns value as FontStyles | (None) | Sets the document’s currently used font style. |
| LineCapStyle | assigns value as LineCapStyles | (None) | Sets the line cap style for vector draw operations. |
| LineDashPattern | dashLength as Double = -1 <br> gapLength as Double = -1 | (None) | Sets the line dash pattern used for vector stroke drawing. |
| LineHeight | assigns value as Double | (None) | Sets the document’s text line height. |
| LineWidth | assigns value as Double | (None) | Sets the pen size of vector line and stroke drawing. |
| MiterLimit | length as Double | (None) | Sets the miter limit of line drawing. |
| Opacity | assigns value as Double | (None) | Sets the opacity applied to vector drawing. |
| PageNumber | assigns value as Integer | (None) | Sets the current page number of the document. |
| RestoreCoordinates | (None) | (None) | Restores previous saved [x,y] coordinates or [0,0]. |
| RestorePage | (None) | (None) | Selects a previously saved page (via Savepage) or the first page. |
| RestoreState | (None) | (None) | Restores the graphical state that was previously saved using SaveState. |
| RightToLeft | assigns value as Boolean | (None) | Sets the document’s drawing methods. |
| SaveCoordinates | (None) | (None) | Saves the current [x,y] coordinates for reuse later with RestoreCoordinates. |
| SavePage | (None) | (None) | Saves the current page number for recall later using RestorePage. |
| SaveState | (None) | (None) | Saves the current graphical state of the document. Font properties, styling, colors, etc. |
| SetPosition | x as Double <br> y as Double | (None) | Sets the current drawing coordinates to the supplied values on the current page. |
| SetRelativePosition | x as Double <br> y as Double | (None) | Updates the current drawing coordinates using relative values. |
| StrokeColor | assigns value as Color | (None) | Sets the current stroke color used for vector drawing. |
| StrokeOpacity | assigns value as Double | (None) | Sets the opacity of vector drawing stroke operations. |
| TextColor | assigns value as Color | (None) | Sets the color used for drawing text. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| Attributes | id | String | (None) |
| Format | Formats | (None) | The format (or size) of the document. |
| Orientation | Orientations | (None) | The orientation (or rotation) of the document. |
| Properties | Internal.Metadata | (None) | Object representing the document’s metadata such as Author, Title, Subject, etc. (Read Only) |
| Protection | Internal.Protection | (None) | Object representing the protection scheme to use on the document. (Read Only) |
| Tag | Variant | (None) | Developer storage. |
| Template | Internal.Template | (None) | Template to apply to the document. Includes page headers, footers, and watermark. |
| Unit | Units | (None) | Unit of measurement used for the document. Points is the recommended unit. |
| ViewerPrefs | Internal.ViewerPrefs | (None) | Allows setting of preferences for the viewer of the document. Not all viewers support this functionality or implement it in the same way. Different viewers may behave differently. |