Class

# PDFDocument

<div class="rst-class">

forsearch

</div>

PDFDocument

<div class="rst-class">

forsearch

</div>

PDF

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

## Description

An object containing graphics and/or text that can be saved to a PDF file.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                       | Type                                          | Read-Only | Shared |
|--------------------------------------------|-----------------------------------------------|-----------|--------|
| `Author<pdfdocument.author>`               | `String</api/data_types/string>`              |           |        |
| `Compressed<pdfdocument.compressed>`       | `Boolean</api/data_types/boolean>`            |           |        |
| `Creator<pdfdocument.creator>`             | `String</api/data_types/string>`              |           |        |
| `CurrentPage<pdfdocument.currentpage>`     | `Integer</api/data_types/integer>`            |           |        |
| `EmbeddedFonts<pdfdocument.embeddedfonts>` | `Boolean</api/data_types/boolean>`            |           |        |
| `Graphics<pdfdocument.graphics>`           | `PDFGraphics</api/pdf/pdfgraphics>`           | ✓         |        |
| `Keywords<pdfdocument.keywords>`           | `String</api/data_types/string>`              |           |        |
| `Landscape<pdfdocument.landscape>`         | `Boolean</api/data_types/boolean>`            |           |        |
| `Language<pdfdocument.language>`           | `String</api/data_types/string>`              |           |        |
| `PageCount<pdfdocument.pagecount>`         | `Integer</api/data_types/integer>`            | ✓         |        |
| `PageHeight<pdfdocument.pageheight>`       | `Double</api/data_types/double>`              |           |        |
| `PageWidth<pdfdocument.pagewidth>`         | `Double</api/data_types/double>`              |           |        |
| `Permissions<pdfdocument.permissions>`     | `PDFPermissions</api/pdf/pdfpermissions>`     |           |        |
| `Subject<pdfdocument.subject>`             | `String</api/data_types/string>`              |           |        |
| `Title<pdfdocument.title>`                 | `String</api/data_types/string>`              |           |        |
| `ViewerOptions<pdfdocument.vieweroptions>` | `PDFViewerOptions</api/pdf/pdfvieweroptions>` |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                             | Parameters                                                                                                                                                                                                                                                                                                                                                                                                                       | Returns                                  | Shared |
|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------|--------|
| `AddAnnotation<pdfdocument.addannotation>`       | message As `String</api/data_types/string>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`                                                                                                                                                                                                                                                                                                    |                                          |        |
| `AddCallout<pdfdocument.addcallout>`             | callout As `PDFCallout</api/pdf/pdfcallout>`                                                                                                                                                                                                                                                                                                                                                                                     |                                          |        |
| `AddChart<pdfdocument.addchart>`                 | chart As `DesktopChart</api/user_interface/desktop/desktopchart>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>` = -1, height As `Double</api/data_types/double>` = -1                                                                                                                                                                                 |                                          |        |
|                                                  | chart As `MobileChart</api/user_interface/mobile/mobilechart>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>` = -1, height As `Double</api/data_types/double>` = -1                                                                                                                                                                                    |                                          |        |
| `AddControl<pdfdocument.addcontrol>`             | `ParamArray</api/language/paramarray>` controls() As `PDFControl</api/pdf/pdfcontrol>`                                                                                                                                                                                                                                                                                                                                           |                                          |        |
|                                                  | controls() As `PDFControl</api/pdf/pdfcontrol>`                                                                                                                                                                                                                                                                                                                                                                                  |                                          |        |
| `AddEmbeddedFile<pdfdocument.addembeddedfile>`   | file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = ""                                                                                                                                                   |                                          |        |
| `AddEmbeddedMovie<pdfdocument.addembeddedmovie>` | file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = ""                                                                                                                                                   |                                          |        |
| `AddEmbeddedSound<pdfdocument.addembeddedsound>` | file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = ""                                                                                                                                                   |                                          |        |
| `AddFonts<pdfdocument.addfonts>`                 | f As `FolderItem</api/files/folderitem>`                                                                                                                                                                                                                                                                                                                                                                                         |                                          | ✓      |
| `AddGoToPageArea<pdfdocument.addgotopagearea>`   | page As `Integer</api/data_types/integer>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, `Optional</api/language/optional>` x1 As `Integer</api/data_types/integer>`, `Optional</api/language/optional>` y1 As `Integer</api/data_types/integer>`                                                |                                          |        |
| `AddLine<pdfdocument.addline>`                   | line As `PDFLine</api/pdf/pdfline>`                                                                                                                                                                                                                                                                                                                                                                                              |                                          |        |
| `AddLinkArea<pdfdocument.addlinkarea>`           | URL As `String</api/data_types/string>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`                                                                                                                                                                                                             |                                          |        |
| `AddLinkToPDFArea<pdfdocument.addlinktopdfarea>` | file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`                                                                                                                                                                                                         |                                          |        |
| `AddMarkup<pdfdocument.addmarkup>`               | x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height as `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = "", markupColor As `Color</api/data_types/color>` = &cFFFF7900, type As `PDFAnnotation.MarkupTypes<pdfannotation.markuptypes>` = `PDFAnnotation.MarkupTypes.Highlight<pdfannotation.markuptypes>` |                                          |        |
| `AddShape<pdfdocument.addshape>`                 | shape As `PDFShape</api/pdf/pdfshape>`                                                                                                                                                                                                                                                                                                                                                                                           |                                          |        |
| `AddTable<pdfdocument.addtable>`                 | table As `PDFTable</api/pdf/pdftable>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                             |                                          |        |
| `AddTOCEntry<pdfdocument.addtocentry>`           | `ParamArray</api/language/paramarray>` entries() As `PDFTOCEntry</api/pdf/pdftocentry>`                                                                                                                                                                                                                                                                                                                                          |                                          |        |
|                                                  | entries() As `PDFTOCEntry</api/pdf/pdftocentry>`                                                                                                                                                                                                                                                                                                                                                                                 |                                          |        |
| `ClearCache<pdfdocument.clearcache>`             |                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                          | ✓      |
| `Constructor<pdfdocument.constructor0>`          | value As `JSONItem</api/text/json/jsonitem>`                                                                                                                                                                                                                                                                                                                                                                                     |                                          |        |
| `Constructor<pdfdocument.constructor1>`          | value As `PDFDocument.PageSizes<pdfdocument.pagesizes>`                                                                                                                                                                                                                                                                                                                                                                          |                                          |        |
| `Constructor<pdfdocument.constructor2>`          | width As `Double</api/data_types/double>`, height As `Double</api/data_types/double>`                                                                                                                                                                                                                                                                                                                                            |                                          |        |
| `Save<pdfdocument.save>`                         | f As `FolderItem</api/files/folderitem>`                                                                                                                                                                                                                                                                                                                                                                                         |                                          |        |
| `Template<pdfdocument.template>`                 |                                                                                                                                                                                                                                                                                                                                                                                                                                  | `JSONItem</api/text/json/jsonitem>`      |        |
| `ToData<pdfdocument.todata>`                     |                                                                                                                                                                                                                                                                                                                                                                                                                                  | `MemoryBlock</api/language/memoryblock>` |        |
| `TransitionAt<pdfdocument.transitionat>`         | page As `Integer</api/data_types/integer>`                                                                                                                                                                                                                                                                                                                                                                                       | `PDFTransition</api/pdf/pdftransition>`  |        |
|                                                  | page As `Integer</api/data_types/integer>`, `Assigns</api/language/assigns>` transition As `PDFTransition</api/pdf/pdftransition>`                                                                                                                                                                                                                                                                                               |                                          |        |

## Enumerations

<div id="pdfdocument.graphicsmethods">

<div class="rst-class">

forsearch

</div>

</div>

PDFDocument.GraphicsMethods

### GraphicsMethods

> All the methods that are supported for creating graphics for <span class="title-ref">PDFDocument</span>. When creating templates via code, these help make the code more readable.
>
> | Name               |
> |--------------------|
> | Bold               |
> | CharacterSpacing   |
> | Clip               |
> | DashPhase          |
> | DrawLine           |
> | DrawOval           |
> | DrawPicture        |
> | DrawPolygon        |
> | DrawRectangle      |
> | DrawRoundRectangle |
> | DrawText           |
> | FillOval           |
> | FillPolygon        |
> | FillRectangle      |
> | FillRoundRectangle |
> | FontName           |
> | FontSize           |
> | Italic             |
> | LineCap            |
> | LineDash           |
> | LineJoin           |
> | MatrixScaleX       |
> | MatrixScaleY       |
> | NextPage           |
> | Outline            |
> | PenColor           |
> | PenSize            |
> | ResetState         |
> | RestoreState       |
> | RotationAngle      |
> | SaveState          |
> | Translate          |
> | Transparency       |
> | Underline          |

<div id="pdfdocument.pagesizes">

<div class="rst-class">

forsearch

</div>

</div>

PDFDocument.PageSizes

### PageSizes

> Specifies the size of the PDF document page.
>
> | Name    |
> |---------|
> | Letter  |
> | Legal   |
> | Tabloid |
> | A4      |
> | A3      |
> | A5      |

<div id="pdfdocument.standardfontnames">

<div class="rst-class">

forsearch

</div>

</div>

PDFDocument.StandardFontNames

### StandardFontNames

The standard embedded fonts available.

> | Name                  |
> |-----------------------|
> | Times                 |
> | Helvetica             |
> | Courier               |
> | Symbol                |
> | ZapfDingbats          |
> | LiberationSans        |
> | LiberationSansBold    |
> | LiberationSansItalic  |
> | LiberationSerif       |
> | LiberationSerifBold   |
> | LiberationSerifItalic |
> | LiberationMono        |
> | LiberationMonoBold    |
> | LiberationMonoItalic  |
> | TimesNewRoman         |
> | Arial                 |

## Property descriptions

<div id="pdfdocument.author">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Author

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

> The name of the person who authored the document. This is stored in the document's metadata to make it possible to find the document with search utilities.

<div id="pdfdocument.compressed">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Compressed

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

> If `True</api/language/true>`, the document is stored compressed.

<div id="pdfdocument.creator">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Creator

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

> The name of the application that created the document.

<div id="pdfdocument.currentpage">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.CurrentPage

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

> The page which is accessed when using page-related properties and methods of the <span class="title-ref">PDFDocument</span> class.

<div id="pdfdocument.embeddedfonts">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.EmbeddedFonts

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

> If `True</api/language/true>`, fonts used in the <span class="title-ref">PDFDocument</span> will be embedded in the created PDF file.

<div id="pdfdocument.graphics">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Graphics

**Graphics** As `PDFGraphics</api/pdf/pdfgraphics>`

> An object that can be used to draw text and graphics into the document.
>
> This property is read-only.

<div id="pdfdocument.keywords">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Keywords

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

> The keywords that best indicate the contents of the document. This is stored in the document's metadata to make it possible to find the document with search utilities.

<div id="pdfdocument.landscape">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Landscape

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

> If `True</api/language/true>`, the document is in landscape orientation.

<div id="pdfdocument.language">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Language

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

> The primary language of the document. This value is used to assist various PDF standard features/behaviors such as pronunciation when reading PDF text aloud.
>
> Acceptable values start with a two letter language code followed by a two letter country code. Example values are en-US and es-ES. A complete set of acceptable values can be found [here](https://www.fincher.org/Utilities/CountryLanguageList.shtml).

<div id="pdfdocument.pagecount">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.PageCount

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

> The number of pages in the document.
>
> This property is read-only.

<div id="pdfdocument.pageheight">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.PageHeight

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

> The height (in points) of a page of the document.

<div id="pdfdocument.pagewidth">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.PageWidth

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

> The width (in points) of a page of the document.

<div id="pdfdocument.permissions">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Permissions

**Permissions** As `PDFPermissions</api/pdf/pdfpermissions>`

> Indicates what limitations (if any) the document has in terms of opening, printing, copying its contents and more.

<div id="pdfdocument.subject">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Subject

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

> The subject of the document. This is stored in the document's metadata to make it possible to find the document with search utilities.

<div id="pdfdocument.title">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Title

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

> The title of the document. This is stored in the document's metadata to make it possible to find the document with search utilities.

<div id="pdfdocument.vieweroptions">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.ViewerOptions

**ViewerOptions** As `PDFViewerOptions</api/pdf/pdfvieweroptions>`

> Sets the UI elements the viewer should display when the document is to be displayed on the screen.

## Method descriptions

<div id="pdfdocument.addannotation">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddAnnotation

**AddAnnotation**(message As `String</api/data_types/string>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`)

> Adds a widget to the current page at the coordinates passed that when clicked displays the message passed.

<div id="pdfdocument.addcallout">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddCallout

**AddCallout**(callout As `PDFCallout</api/pdf/pdfcallout>`)

> Adds the *callout* to the current page of the PDF document.

<div id="pdfdocument.addchart">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddChart

**AddChart**(chart As `DesktopChart</api/user_interface/desktop/desktopchart>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>` = -1, height As `Double</api/data_types/double>` = -1)

**AddChart**(chart As `MobileChart</api/user_interface/mobile/mobilechart>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`, width As `Double</api/data_types/double>` = -1, height As `Double</api/data_types/double>` = -1)

> Adds the *chart* to the current page of the PDF document at the coordinates and size specified.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>

<div id="pdfdocument.addcontrol">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddControl

**AddControl**(`ParamArray</api/language/paramarray>` controls() As `PDFControl</api/pdf/pdfcontrol>`)

> Adds the array of controls passed to the PDF document.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>

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

<div class="rst-class">

forsearch

</div>

PDFDocument.AddControl

**AddControl**(controls() As `PDFControl</api/pdf/pdfcontrol>`)

> Adds the array of controls passed to the PDF document.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>

<div id="pdfdocument.addembeddedfile">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddEmbeddedFile

**AddEmbeddedFile**(file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = "")

> Embeds *file* into the current page of the PDF document and indicates a clickable region that, when clicked, opens the embedded document with the associated app.
>
> ``` xojo
> Var d As New PDFDocument
> Var g As Graphics = d.Graphics
> Var f As FolderItem = FolderItem.ShowOpenFileDialog("")
>
> Const kAttachedFileText As String = "Attached File"
>
> g.DrawText(kAttachedFileText, 20 , 20)
>
> If f <> Nil Then
> d.AddEmbeddedFile(f, 20, 20, g.TextWidth(kAttachedFileText), g.TextHeight)
> End If
> ```

<div id="pdfdocument.addembeddedmovie">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddEmbeddedMovie

**AddEmbeddedMovie**(file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = "")

> Embeds the movie *file* (.mp4 format) to the current page of the PDF Document. The movie will play, when the user double-clicks the active icon on the page.
>
> <div class="warning">
>
> <div class="title">
>
> Warning
>
> </div>
>
> Due to a known issue in Adobe Acrobat on Windows, to properly play embedded movies, the graphics settings must be [properly configured](https://community.adobe.com/t5/acrobat-discussions/embedded-video-in-a-pdf-file-won-t-play-in-adobe-reader/td-p/11913858).
>
> </div>
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>

<div id="pdfdocument.addembeddedsound">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddEmbeddedSound

**AddEmbeddedSound**(file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = "")

> Embeds the sound *file* (AIFF, 2 Channels, 16 bits, 44.1) into the current page of the PDF document and describes an active area that when double-clicked, plays the sound.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>
>
> ``` xojo
> Const kAttachedSound = "Some nice sound"
> Var d As New PDFDocument
> Var g As Graphics = d.Graphics
> Var f As FolderItem = FolderItem.ShowOpenFileDialog("")
>
> If f <> Nil Then
> d.AddEmbeddedSound(f, 100, 20, g.TextWidth(kAttachedSound), g.TextHeight, kAttachedSound)
> End If
> ```

<div id="pdfdocument.addfonts">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddFonts

**AddFonts**(f As `FolderItem</api/files/folderitem>`)

> All fonts within the folder and any subfolders are embedded within the document so that they are not required to be installed on the user's machine in order for text that uses them to be rendered properly with those fonts.
>
> This method is `shared</api/language/shared>`.
>
> This example makes the fonts copied into the Resources \> Fonts folder of the compiled app available to the <span class="title-ref">PDFDocument</span> created:
>
> ``` xojo
> Var d As New PDFDocument
> d.AddFonts(SpecialFolder.Resource("Fonts"))
> ```

<div id="pdfdocument.addgotopagearea">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddGoToPageArea

**AddGoToPageArea**(page As `Integer</api/data_types/integer>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`, `Optional</api/language/optional>` x1 As `Integer</api/data_types/integer>`, `Optional</api/language/optional>` y1 As `Integer</api/data_types/integer>`)

> Designates an area of the current page that will go to the page passed when pressed.
>
> Providing the optional x1 and y1 parameters will ensure that the area of the page to which the user goes is visible.

<div id="pdfdocument.addline">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddLine

**AddLine**(line As `PDFLine</api/pdf/pdfline>`)

> Adds *line* to the current page of the PDF Document.

<div id="pdfdocument.addlinkarea">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddLinkArea

**AddLinkArea**(URL As `String</api/data_types/string>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`)

> Designates an area of the current page that will go to the URL passed when pressed.

<div id="pdfdocument.addlinktopdfarea">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddLinkToPDFArea

**AddLinkToPDFArea**(file As `FolderItem</api/files/folderitem>`, x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height As `Integer</api/data_types/integer>`)

> Designates an area of the current page that will open the PDF file passed when pressed.

<div id="pdfdocument.addmarkup">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddMarkup

**AddMarkup**(x As `Integer</api/data_types/integer>`, y As `Integer</api/data_types/integer>`, width As `Integer</api/data_types/integer>`, height as `Integer</api/data_types/integer>`, description As `String</api/data_types/string>` = "", markupColor As `Color</api/data_types/color>` = &cFFFF7900, type As `PDFAnnotation.MarkupTypes<pdfannotation.markuptypes>` = `PDFAnnotation.MarkupTypes.Highlight<pdfannotation.markuptypes>`)

> Adds any of the predefined styles of markup to the text found below the active area (as described by the x, y, width and height values) on the current page of a <span class="title-ref">PDFDocument</span> instance. When double-clicked it opens a popup annotation window.
>
> ``` xojo
> ' This example highlights the text found below the active area of the added markup annotation.
>
> Var d As New PDFDocument
> Var g As Graphics = d.Graphics
>
> Const kSampleText As String = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent placerat nisi vitae erat pharetra, ac consequat dui facilisis. Pellentesque quis sem non velit dictum fringilla id nec odio. Maecenas ultricies mi sed mauris dignissim sagittis. Pellentesque quis diam ligula. Nunc eu velit in tortor rhoncus commodo. Fusce a mi urna. In semper ex et volutpat lobortis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Sed magna elit, lacinia vel leo a, egestas ornare est. Donec nec feugiat arcu."
>
> g.DrawText(kSampleText, 20, 500, 400)
>
> Var h As Double = g.TextHeight(kSampleText, 400)
>
> d.AddMarkup(20, 500 - g.TextHeight, 400, h, "Annotation Description")
> ```

<div id="pdfdocument.addshape">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddShape

**AddShape**(shape As `PDFShape</api/pdf/pdfshape>`)

> Adds the shape to the current page of the PDF document.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>

<div id="pdfdocument.addtable">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddTable

**AddTable**(table As `PDFTable</api/pdf/pdftable>`, x As `Double</api/data_types/double>`, y As `Double</api/data_types/double>`)

> Adds the *table* passed at the *x* and *y* coordinates passed.

<div id="pdfdocument.addtocentry">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.AddTOCEntry

**AddTOCEntry**(`ParamArray</api/language/paramarray>` entries() As `PDFTOCEntry</api/pdf/pdftocentry>`)

> Creates a table of contents from the array of `PDFTOCEntrys</api/pdf/pdftocentry>` passed.

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

<div class="rst-class">

forsearch

</div>

PDFDocument.AddTOCEntry

**AddTOCEntry**(entries() As `PDFTOCEntry</api/pdf/pdftocentry>`)

> Creates a table of contents from the array of `PDFTOCEntrys</api/pdf/pdftocentry>` passed.

<div id="pdfdocument.clearcache">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.ClearCache

**ClearCache**

> Clears (deletes) all files created in the temporary folder as a result of various font operations.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This method is not currently supported for Android.
>
> </div>

<div id="pdfdocument.constructor0">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Constructor

**Constructor**(value As `JSONItem</api/text/json/jsonitem>`)

> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> `Constructors</api/language/constructor>` are special methods called when you create an object with the `New</api/language/new>` keyword and pass in the parameters above.
>
> </div>
>
> Creates a <span class="title-ref">PDFDocument</span> based upon the <span class="title-ref">JSON</span> data passed.

<div id="pdfdocument.constructor1">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Constructor

**Constructor**(value As `PDFDocument.PageSizes<pdfdocument.pagesizes>`)

> Creates a <span class="title-ref">PDFDocument</span> where the page size is based on the PageSize passed.

<div id="pdfdocument.constructor2">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Constructor

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

> Creates a <span class="title-ref">PDFDocument</span> where the page size is based width and height passed.

<div id="pdfdocument.save">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Save

**Save**(f As `FolderItem</api/files/folderitem>`)

> Creates the PDF document and saves the graphics and metadata to it.

<div id="pdfdocument.template">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.Template

**Template** As `JSONItem</api/text/json/jsonitem>`

> Returns a JSONItem that represents the <span class="title-ref">PDFDocument</span> in <span class="title-ref">JSON</span> format.
>
> This <span class="title-ref">JSON</span> data can be passed into the <span class="title-ref">PDFDocument</span> constructor to create a <span class="title-ref">PDFDocument</span> effectively making this data act as a template.

<div id="pdfdocument.todata">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.ToData

**ToData** As `MemoryBlock</api/language/memoryblock>`

> Returns a MemoryBlock that represents the <span class="title-ref">PDFDocument</span>'s contents.

<div id="pdfdocument.transitionat">

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

</div>

<div class="rst-class">

forsearch

</div>

PDFDocument.TransitionAt

**TransitionAt**(page As `Integer</api/data_types/integer>`) As `PDFTransition</api/pdf/pdftransition>`

> Gets the `PDFTransition</api/pdf/pdftransition>` for the *page* passed.

**TransitionAt**(page As `Integer</api/data_types/integer>`, `Assigns</api/language/assigns>` transition As `PDFTransition</api/pdf/pdftransition>`)

> Sets a `PDFTransition</api/pdf/pdftransition>` for the *page* passed.
>
> Transitions can be applied to a <span class="title-ref">PDFDocument</span> page to be used by the viewer app when enabled in presentation or slide show modes.

## Notes

<span class="title-ref">PDFDocument</span> supports only .ttf and .otf font files.

<div class="warning">

<div class="title">

Warning

</div>

On Linux, <span class="title-ref">PDFDocument</span> requires the Pango library to be installed. While it is installed by default on most Linux distributions, if it's missing and you call a <span class="title-ref">PDFDocument</span> function, an exception will be raised.

</div>

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

### Drawing

Every new object is drawn above the previous one in the same way as the `Graphics</api/graphics/graphics>` class does in all other cases.

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

### Meta data

The Author, Keywords, Subject and Title are metadata values that can be used by search utilities to find the document.

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

### <span class="title-ref">JSON</span> format

PDFDocuments can be created by passing <span class="title-ref">JSON</span> data to the Constructor (see Constructors above). The <span class="title-ref">JSON</span> format required is as follows:

``` json
{
    "General": {
        "Author": String,
        "Creator": String,
        "Keywords": String,
        "Subject": String,
        "Title": String
    },
    "Document": {
        "Compression": Boolean,
        "EmbeddedFonts": Boolean,
        "Landscape": Boolean,
        "Width": Double,
        "Height": Double
    },
    "Actions": { Dictionary { Dictionary } }
    "Images": { Dictionary { Dictionary } }
}
```

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

### Actions

Actions is a Dictionary of dictionaries, each containing a single graphics command and parameters you wish to invoke. For example:

``` json
"Actions": {
        "0": {
            "Color": "&h00FFFFFF"
        },
        "1": {
            "FillRectangle": ".00,.00,612.00,792.00"
        },
        "2": {
            "FontName": "Helvetica"
        },
       "3": {
            "DrawText": "Sample text,_ENDTEXT_,100,200,200,False"
       }
}
```

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

### Images

Images is a Dictionary of dictionaries, each containing a single Base64-encoded image from the document (when generated but the `Template<pdfdocument.template>` method) regardless of how many times that image appears in the document. For example:

``` json
"Images":{
          "0":
                {"0":"\/9j\/4AAQSkZJRgABAQAASABIAAD………"},
          "1":
                {"1":"\/9j\/4AAQSkZJRgABAQAASABIAAD………"},
          "2":
                {"2":"\/9j\/4AAQSkZJRgABAQAASABIAAD………"}
}
```

Note that if you are planning to create this manually, the inner key must match the outer key.

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

### Drawing text

The \_[ENDTEXT]() marker delimits the end of the text to be drawn from the rest of the parameters. This simplifies the <span class="title-ref">JSON</span> structure when created manually.

You can also save your <span class="title-ref">PDFDocument</span> <span class="title-ref">JSON</span> data for use later as a template, by calling the `Template<pdfdocument.template>` method.

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

## Sample code

This example creates a <span class="title-ref">PDFDocument</span> object then draws a bar chart into and saves it to a file on the desktop:

``` xojo
Var pdf As New PDFDocument
Var g As Graphics = pdf.Graphics
g.PenSize = 1
g.DrawLine(0, 0, 0, 324)
g.DrawLine(0, 324, g.Width, 324)

Var r As New Random
Var startX As Integer = 1
Var colors() As Color
Var bars() As Integer

If colors.LastIndex = -1 Then
  For n As Integer = 0 To 5
    colors.Add(Color.RGB(r.InRange(0, 255), r.InRange(0, 255), r.InRange(0, 255)))
    bars.Add(r.InRange(325 * 0.1, 325 - 325 * 0.2))
  Next
End If

Var barWidth As Integer = g.Width / 6 * 0.8
Var spaceBetween As Integer = g.Width / 6 * 0.2
For n As Integer = 0 To 5
  g.DrawingColor = colors(n)
  g.FillRectangle(startX, 325 - bars(n), barWidth, bars(n) - 1)
  startX = startX + barWidth + spaceBetween
Next

Var f As FolderItem = SpecialFolder.Desktop.Child("Barchart.pdf")
pdf.Save(f)
```

## Compatibility

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

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `PDFTable</api/pdf/pdftable>`, `DesktopCanvas</api/user_interface/desktop/desktopcanvas>` control; `PrinterSetup</api/printing/printersetup>` class

</div>
