Skip to content

Latest commit

 

History

History
87 lines (71 loc) · 4.16 KB

document.md

File metadata and controls

87 lines (71 loc) · 4.16 KB

Documents

The document object represents (and contains) the actual PDF document. A document can either be a signable document or an unsignable annex. Note that document are always linked to a case file and can't exist on their own.

Creating a document

Creating a document requires that you have a case file first since a document can't exist on its own. The case file must be passed to the Document constructor and the document will be linked to the case file. Per default, a document is an annex that can't be signed. To make a document signable, the MakeSignable() method must be called. The following example shows how to create a signable document linked to myCaseFile:

// Create a new document object with title and link actual PDF document
var myDocument = new Document(myCaseFile, "My brand new document", "/path/to/pdfFile");

// Make the document signable
myDocument.MakeSignable();

// Finally, persist the object
myDocument.Persist();

Retrieve existing documents

There is several ways to retrieve document from Penneo. Available methods for retrieving documents are:

  • Query.Find(int id) Find one specific case file by its ID.
  • Query.FindAll Find all documents accessible by the authenticated user.
  • Query.FindBy(Dictionary<string, object> criteria = null, Dictionary<string, string> orderBy = null, int? limit = null, int? offset = null) Find all documents matching criteria ordered by orderBy. If limit is set, only limit results are returned. If offset is set, the offset first results are skipped. Criteria can either be title or metaData.
  • Query.FindOneBy(Dictionary<string, object> criteria = null, Dictionary<string, string> orderBy = null) Same as FindBy setting limit = 1 and offset = null

Below is a couple of examples:

// Retrieve all documents
var myDocuments = Query.FindAll<Document>();

// Retrieve a specific document (by id)
var myDocument = Query.Find<Document>(7382393);

// Retrieve all documents that contains the word "the" in their title and sort descending by creation date
var myDocuments = Query.FindBy<Document>(
	criteria: new Dictionary<string, object>{ { "title", "the" } },
	orderBy: new Dictionary<string, string>(){ { "created", "desc" } }
);

// Retrieve documents from offset 10 until 110 ordered by title in ascending order
var myDocuments = Query.FindBy<Document>(	
	orderBy: new Dictionary<string, string>(){ {"title", "asc" } },
	limit: 10,
	offset: 100
);

Retrieving the signed document

When the signing process is completed (when GetStatus() returns "completed"), the signed PDF document can be retrieved by calling the GetPdf() method on the document object in question.

Retrieving linked objects

A signable document contains signature lines. These objects can be retrieved using the following methods:

  • GetSignatureLines() Returns the signature lines linked to the document as an array of signature line objects.
  • FindSignatureLine(int id) Find and return a specific signature line by id.

State variables

A series state variables are used to describe the document state over the course of its life time. The methods for retrieving the state variables are described below:

  • GetStatus() Returns the status of the document as a string. Possible status values are:
  • New: The document hasn't been sent out for signing yet
  • Pending: The document is out for signing
  • Rejected: One of the signers has rejected to sign
  • Deleted: The document has been out for signing but have since been deleted
  • Signed: The document is signed, but the signed document is not generated yet
  • Completed: The signing process is completed
  • Created Returns the date and time when the document was created as a DateTime object.
  • Modified Returns the date and time when the document was last modified as a DateTime object.
  • Completed Returns the date and time when the document signing process was finalized as a DateTime object.
  • DocumentId Returns the unique ID that is stamped on every page in the document for identification purposes.
  • Options Returns the option values assigned to the document.