# 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 |
| --- | :---: | :---: | --- |
| Sub | AddAnnotation | (None) | Adds an annotation object to the document. |
| Sub | AddFont | (None) | Adds a font file to the document. |
| Sub | AddFont | (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. |
| Sub | AddFormElement | (None) | Adds an AcroForms object to the document. |
| Sub | AddPage | (None) | Adds a new page to the document using the global measurements set when creating the document. |
| Sub | AddPage | (None) | Adds a page to the document with a custom set of measurements. |
| Sub | AddPage | (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. |
| Sub | CharacterSpacing | (None) | Determines the spacing between characters when drawing text. |
| Sub | Constructor | (None) | Creates a new instance of the class. |
| Function | CreatePageSurface | As | Creates a Xojo Picture objec tthat can be drawn to and passed to AddPage to create a page with a raster backdrop. |
| Sub | DrawBezier | (None) | Draws a bezier curve to the current page at the current coordinates. |
| Sub | DrawCircle | (None) | Draws a circle to the current page at the current coordinates. |
| Sub | DrawEllipse | (None) | Draws an ellipse to the current page at the current coordinates. |
| Sub | DrawHTML | (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. |
| Sub | DrawImage | (None) | Draws an image to the current page at the current coordinates. |
| Sub | DrawLine | (None) | Draws a line to the current page at the current coordinates. |
| Sub | DrawPath | (None) | Draws a path to the current page at the current coordinates. |
| Sub | DrawRectangle | (None) | Draws a rectangle to the current page at the current coordinates. |
| Sub | DrawRoundedRectangle | (None) | Draws a rounded rectangle to the current page at the current coordinates. |
| Sub | DrawSVG | (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. |
| Sub | DrawTable | (None) | Draws a table to the current page at the current coordinates. |
| Sub | DrawText | (None) | Draws a text object to the current page at the current coordinates. |
| Sub | DrawTriangle | (None) | Draws a triangle to the current page at the current coordinates. |
| Sub | EnableClipping | (None) | Enables clipping of elements. Should follow a call to SaveState and a vector draw operation. Call RestoreState to exit clipping mode. |
| Sub | FillCircle | (None) | Draws a filled circle to the current page at the current coordinates. |
| Sub | FillColor | (None) | Sets the current vector fill color of the document. |
| Sub | FillEllipse | (None) | Draws a filled ellipse to the current page at the current coordinates. |
| Sub | FillOpacity | (None) | Sets the current vector draw fill opacity. |
| Sub | FillPath | (None) | Draws a filled path to the document. |
| Sub | FillRectangle | (None) | Draws a filled Rectangle to the current page at the current coordinates. |
| Sub | FillRoundedRectangle | (None) | Draws a filled rounded rectangle to the current page at the current coordinates. |
| Sub | FillTriangle | (None) | Draws a filled triangle to the current page at the current coordinates. |
| Sub | FontName | (None) | Sets the document’s currently used font name. |
| Sub | FontSize | (None) | Sets the document’s currently used font size. |
| Sub | FontStyle | (None) | Sets the document’s currently used font style. |
| Attributes | Hidden | Function | |
| Sub | LineCapStyle | (None) | Sets the line cap style for vector draw operations. |
| Sub | LineDashPattern | (None) | Sets the line dash pattern used for vector stroke drawing. |
| Sub | LineHeight | (None) | Sets the document’s text line height. |
| Sub | LineWidth | (None) | Sets the pen size of vector line and stroke drawing. |
| Sub | MiterLimit | (None) | Sets the miter limit of line drawing. |
| Sub | Opacity | (None) | Sets the opacity applied to vector drawing. |
| Sub | PageNumber | (None) | Sets the current page number of the document. |
| Sub | RestoreCoordinates | (None) | Restores previous saved [x,y] coordinates or [0,0]. |
| Sub | RestorePage | (None) | Selects a previously saved page (via Savepage) or the first page. |
| Sub | RestoreState | (None) | Restores the graphical state that was previously saved using SaveState. |
| Sub | RightToLeft | (None) | Sets the document’s drawing methods. |
| Sub | SaveCoordinates | (None) | Saves the current [x,y] coordinates for reuse later with RestoreCoordinates. |
| Sub | SavePage | (None) | Saves the current page number for recall later using RestorePage. |
| Sub | SaveState | (None) | Saves the current graphical state of the document. Font properties, styling, colors, etc. |
| Sub | SetPosition | (None) | Sets the current drawing coordinates to the supplied values on the current page. |
| Sub | SetRelativePosition | (None) | Updates the current drawing coordinates using relative values. |
| Sub | StrokeColor | (None) | Sets the current stroke color used for vector drawing. |
| Sub | StrokeOpacity | (None) | Sets the opacity of vector drawing stroke operations. |
| Sub | TextColor | (None) | Sets the color used for drawing text. |
| Attributes | Hidden | toJavaScript | |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| Attributes | id | String | |
| Format | Formats | Nil | The format (or size) of the document. |
| Orientation | Orientations | Nil | The orientation (or rotation) of the document. |
| Private | | String | |
| Properties | Internal.Metadata | Nil | Object representing the document’s metadata such as Author, Title, Subject, etc. (Read Only) |
| Protection | Internal.Protection | Nil | Object representing the protection scheme to use on the document. (Read Only) |
| Tag | Variant | Nil | Developer storage. |
| Template | Internal.Template | Nil | Template to apply to the document. Includes page headers, footers, and watermark. |
| Unit | Units | Nil | Unit of measurement used for the document. Points is the recommended unit. |
| ViewerPrefs | Internal.ViewerPrefs | Nil | 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. |