new Vecta.Document()
Vecta document object.
In the Vecta application, the created Vecta.Document will always return the currently loaded drawing called the active document.
See also:
Methods
.created() Returns: string
Get the document created date.
Returns:
Returns the drawing's created date in Mm dd, YY
.creator() Returns: string
Get the document creator.
Returns:
Returns the creator's name if available.
.edited() Returns: string
Get document last edited date.
Returns:
Returns the drawing's last edited date in Mm dd, YY
.id() Returns: string
Get the document id.
Returns:
Returns the document ID.
.json([data]) Returns: object
Get or set custom json data for document.
Name | Type | Attributes | Description |
---|---|---|---|
data | object | optional | Custom json to set. If not provided, returns the custom json. |
Returns:
Returns custom json
Examples:
Vecta.activeDoc.json({a: 1, b: 2});
console.log(Vecta.activeDoc.json()); // {a: 1, b: 2}
.layers([id]) Returns: Vecta.Layer|Vecta.Layer[]
Get all layers or a single layer in the document.
Name | Type | Attributes | Description |
---|---|---|---|
id | string | optional | The layer ID to get or undefined if get all. |
Returns:
Returns Vecta.Layer or and array of Vecta.Layer.
Examples:
var layers = Vecta.activeDoc.layers();
See also:
.pages() Returns: array
Returns a list of page id in the document.
Returns:
An array of page id in the document
.stencils() Returns: Vecta.Stencil[]
Get a list of stencils currently opened in the document.
Returns:
Returns an array of stencil object.
Examples:
console.log(Vecta.activeDoc.stencils());
See also:
.styles(attr) Returns: string|number|null
Get the document default styling.
Name | Type | Description |
---|---|---|
attr | string | The attribute to get. Can be any of the following:
|
Returns:
Returns the default style.
Examples:
console.log(Vecta.activeDoc.styles('fill')); //#ffffff
.title([title]) Returns: string
Get or set the document's title.
Name | Type | Attributes | Description |
---|---|---|---|
title | string | optional | The new document title |
Returns:
Returns document title
Examples:
console.log(Vecta.activeDoc.title()); //Untitled Drawing
console.log(Vecta.activeDoc.title('Hello world!')); //sets Hello world! as the document title.