Usage

In order to use the viewer, you will need an app with an API Key, example:

76573afe92a096010c30a83bc64456da53973aee

The API is located at:

https://viewer.filelabel.co/api/

Basic Steps

Step 1: Authentication

Authenticate with your API key using the following URL:

https://viewer.filelabel.co/api/?action=auth&apiKey=76573afe92a096010c30a83bc64456da53973aee

Parameters

action: auth
apiKey: your api key

You will receive an accessToken in response which you can use in your application to access the viewer. Use the access token on each subsequent response in the session.

Step 2: Load a Document

URL:

https://viewer.filelabel.co/api/?action=load&accessToken=YOUR_TOKEN&doc=http://viewer.filelabel.co/documents/file.pdf

Parameters

action: load
accessToken: token from step 1
doc: url encoded path to a supported document

You will receive a complex JSON object which represents the document in question. The document will be cached on the server for future requests.

Step 3: The Viewer

Once you have authenticated, you can load the viewer on the front end to view your document with the accessToken and doc parameters:

https://viewer.filelabel.co/?accessToken=YOUR_TOKEN&doc=http://viewer.filelabel.co/documents/file.pdf

File Formats

The viewer supports the following file types:

Adobe

  1. http://viewer.filelabel.co/documents/file.pdf
  2. http://viewer.filelabel.co/documents/file.tif
  3. http://viewer.filelabel.co/documents/file.ai
  4. http://viewer.filelabel.co/documents/file.psd
  5. http://viewer.filelabel.co/documents/file.eps

Documents

  1. http://viewer.filelabel.co/documents/file.doc
  2. http://viewer.filelabel.co/documents/file.docx
  3. http://viewer.filelabel.co/documents/file.rtf
  4. http://viewer.filelabel.co/documents/file.txt

Spreadsheets

  1. http://viewer.filelabel.co/documents/file.xls
  2. http://viewer.filelabel.co/documents/file.xlsx
  3. http://viewer.filelabel.co/documents/file.csv

Images

  1. http://viewer.filelabel.co/documents/file.png
  2. http://viewer.filelabel.co/documents/file.gif
  3. http://viewer.filelabel.co/documents/file.jpg

All of these documents can be loaded from the steps above.


Extra Features

URL Obfuscation

If you're loading your documents from a URL, you may want to hide this URL from your users. Our PHP Library contains a simple cipher which will encrypt the URL with your api key. This can only be used in server side implementations.

Server side URLs

Obfuscation is useful if you'd like to provide a link to your documents without revealing their original location. However, for further security, you can transmit your document URL into the session along with your auth request, then load the viewer. The viewer will load without the "doc" parameter and you will have to run the auth request again to change the session. This is specified in the auth request with the "url" parameter.

Permissions

You can customize the permissions level programatically by passing a JSON encoded "permissions" parameter when you run the authentication. An example permissions object is:

{
    'annotate':false,
    'download':true,
    'hideAnnotations':true,
    'print':false,
    'share':true,
    'stickyNotes':true        
}
Powered by simplicity.online