npm SDK File Loading
Once you have a resource ID,openFile is the one method to remember. Tell it
which viewer you are using and it will return the matching data:
result.viewer before reading the viewer-specific fields.
Open the returned file
openFile retrieves and authorizes the resource, but it does not create a
viewer component. After an Apryse call, hand the returned Blob to Apryse or
create a temporary browser URL:
Documents
For a regular document preview or download, use the document ID as the resource ID:Templates
Templates work the same way, but you first ask Artos for the template resource ID:Source files
Source files need one extra lookup. Resolve the source reference to a resource ID, then pass that ID toopenFile:
sourcefile-... resources, openFile uses authenticated POST /source-file. Documents, templates, and generated outputs use the
document-session flow. In both cases, you pass the resource ID; you do not
construct an S3 URL or append a session token.
OnlyOffice
To open a resource in OnlyOffice, use the same method withviewer: 'onlyoffice':
edit requests an editable editor. readonly disables editing and saving.
Source files, templates, generated outputs, and duplicate outputs may be
forced read-only by the backend regardless of the requested mode.
For editable documents, OnlyOffice sends saves through the callback in the
generated config. Keep config and token from the same response, leave the
config unchanged, and request a new result when reopening an expired editor
session.