Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Fluent RESTful Client v2 With Webviewer Sample

Overview

This is a sample application that uses the Fluent JavaScript RESTful Client to generate a document and displays the result with Apryse WebViewer. This application, when started will allow you to navigate to the webpage, click the "Generate Document" button and will then show the output in the WebViewer window. The WebViewer window will initially be populated with the sample template.

There are 3 main files to worry about:

  1. server.ts
    • This file is the Node.js server file that also contains the document generation logic
  2. index.html
    • This file contains the code for the webpage as well as initializing and using Apryse WebViewer
  3. config.json
    • This file contains the config options to specify your license keys, your RESTful Engine instance to be used by the application as well as the properties for which template you would like to generate output for.

Requirements

  • Make sure you have Node.js installed on your machine (which includes npm).
  • You need a running instance of the Fluent RESTful Engine.
  • (Optional) WebViewer License Key. To get a trial key you can go here.
    • If you don't specify a license, a watermark will be present on output, but it is still fully usable
  • (Optional) Fluent Engine Key. To get a trial key you can go here.
    • If you don't specify a license, a watermark will be present on output, but it is still fully usable

Usage

  1. Open the config.json file and insert your RESTful Engine URL (This is required)
    • You can insert your Fluent and WebViewer license keys as well but this isn't required to use the sample.
  2. Open a terminal and navigate to the root of this project
  3. Run the command npm install to install the required packages
  4. Run the command npm run build to build the project
  5. Run the command npm start to start the project. This should start the server at http://localhost:3000.
  6. Open your browser and navigate to http://localhost:3000 to start using the sample app.

Config File Reference

  • template-connection-string: This is the property where you will place the remote url or filepath for the template you would like to generate output for.
    • It is strongly recommended that if you are using local files, to place them in the files directory and reference the file using relative paths. This allows Webviewer to display the template when the application starts
  • output-format: This is the output format for the document that will be generated. Valid options are
    • docx/xlsx/pptx (must match your template format)
    • pdf
    • html
  • datasources: This is a list of datasources that are required for your template. Each datasource takes 3 values:
    • name: The user-given name of the datasource used in the template
    • type: The type of datasource it is. Valid datasource types are:
      • xml: The legacy xml datasource
      • xml2: The modern (saxon) xml datasource
      • json: A json file datasource
      • sql: A SQL datasource
    • connection-string: This is the connection string for the datasource. This can be a url/path to a file, or a jdbc formatted connection string for SQL.
  • input-parameters: This is a list of input parameters needed for the template. Each input parameter takes 3 values:
    • name: The name of the input parameter
    • type: The type of the input parameter. Valid types are:
      • string: A text based value
      • boolean: A true/false value
      • datetime: A date/time based value
      • number: A number value (doesn't include decimals)
      • decimal: A number value that includes decimals
    • value: The value fo the input parameter to use during output generation

Additional Information

  • More information about the Fluent Client API can be found here.
  • More information about using WebViewer can be found here.