Skip to content

Save

Saves the changes to the document and returns the current document instance.

1
myDocument.Save():Document

Returns

The current Document instance.

Remarks

When creating a new document with $Documents.New, it will be in the "Draft" state until you use a method to save it. However, Document.Save will save the new document to the repository but not in a specific folder (it will be in the system but not shown anywhere). If you want to save the new document to be able to access it from a specific folder, see Document.Publish.

In short, this method is best for changes made to existing documents. To save new documents, use the Document.Publish method.

Creating a new document, publishing it, making some changes, and saving the changes

1
2
3
4
5
6
var doc = $Documents.New('My Document');
doc.Files.AddPDF('<p>Hello</p>', 'report.pdf'); // content of a document
doc.Publish(["myfolder", "otherfolder"]); // folders in which the document will be published (this is very important for saving a new document)

doc.Title = 'Sample Document'; // making some changes on an existing document
doc.Save(); // saving the changes (only after the document is already published)

See Also