Creating and Viewing documents
A users documents can be managed using the User
object. An instance of this object can be retrieved by using a login method on the CollabClient instance. See logging in users for more details.
#
Creating documentsDocuments are created with the User.createDocument API.
options
(CreateDocumentOptions)options.document
(Blob | File | URL) The document itself.options.name
(string) The name of the documentoptions.isPublic?
(boolean, optional) Sets whether or not the document is public. More information hereoptions.id?
(string | number, optional) If you want to assign a specific ID to the document, set it here. Otherwise, one will be generated by the database.
Returns an instance of Document.
note
Creating a document does not display it in the viewer. To display the document, use the document.view()
function.
#
Viewing documentsOnce you have an instance of the Document object, you can call Document.view
to display it in the viewer.
note
There are many ways to get an instance of Document. For more info, see getting user documents.
file
(Blob | File | URL) The file you want to load. Since PDFTron Collaboration does not handle file storage, the actual document must be provided for display (see more info here)
Returns a promise that resolves once the file is loaded.
#
Getting documentsSee the getting user documents guide for more information on getting a list of a user's documents.