Sample Applications

This chapter describes sample applications shipped with Web View Export. Each of the sample applications included in this SDK is designed to highlight a specific aspect of the technology’s functionality. We ship built versions of these sample applications. The compiled executables should be in the root directory where the product is installed.

This chapter includes the following sections:

Parent topic: Getting Started with Web View Export

Building the Samples on a Windows System

Microsoft Visual Studio 2010 files are provided for building each of the sample applications.

Because .vcxproj files may not pick up the right compiler on their own, you need to make sure that you are building with the correct configuration in Visual Studio 2010 or higher.

The project files for the sample applications can be found in the samplecode\win subdirectory of the Oracle Outside In SDK.

For specific information about building the sample applications on your UNIX OS, see UNIX Implementation Details.

An Overview of the Sample Applications

Here’s a quick tour of the sample applications provided with this product. Not all of the sample applications are provided for both the Windows and UNIX platforms. See the heading of each application’s subsection for clarification.

This section includes the following sample applications:

demoserver_node.js

The sample application demoserver_node.js is a minimalist web server designed for testing the features of Outside In Web View Export. Its main use is to automate the conversion of input files via the Web View Export Sample Application wv_sample_exporter, and serve the results to a web browser.

Architecture

demoserver is implemented as a javascript file that is executed by node.js. Node.js is available on multiple platforms, and demoserver should work on Linux as well as Windows.

Installation

Installation requires the following steps:

  1. Install node.js

  2. Get demoserver.js and demoserver.config from the sample application directory demoserver_nodejs

  3. Edit demoserver.config to configure demoserver. This part may be optional if you run the demoserver from the same directory where it appears in the Web View Export SDK. By default, it is configured to look for the Web View Export executable files in the demo subdirectory of the SDK.

Once configured, you run the server with the command line:

node demoserver.js

Configuration

At startup, demoserver.js will load demoserver.config and use the options as specified. These options are only read at startup time, so if you wish to change an option, you must restart demoserver.

Here is a sample configuration:

{
  port: 80,
 
  // map of virtual directories
  dirmap: [ 
    { vpath: '/samplefiles', fspath: '../../samplefiles' },
    { vpath: '/out/',        fspath: './output' },
    { vpath: '/assets/',     fspath: '../../assets'},
    { vpath: '/scripts/',    fspath: '../scripts'},
    ],
 
  export_config: 
  {
  // exporter program
    exporter: "../../demo/wv_sample_exporter.exe",
 
  // (optional) extra parameters for exporter program, as an array of strings
    params: ["-r", "/assets/", "-s", "/scripts/demoapp.js"],
 
  // Output virtual directory
    output: "/out/",
  },  
}

Note that this file is a Javascript object declaration, and will be directly interpreted as such at run time. If you break the Javascript syntax of the file, the server will exit with an error message. (It’s actually Javascript as opposed to JSON format. The syntax is mostly the same, but because Javascript allows comments and JSON does not, Javascript was used.)

Remember these rules:

Configuration Parameters

filebrowse.html

This is a page supplied with demoserver_node.js that you can use to navigate directories on your file system to conveniently export documents at will.

wv_sample_exporter

The sample application wv_sample_exporter uses the Web View Export SDK to produce HTML5 output files. It has two required parameters, the first being the input file name and the second being the name of the primary output file; as in:

wv_sample_exporter InputFile OutputFile

The following command line switches are used with this application to modify the way the HTML5 output is produced.

Switch Parameters Function SDK Function

-p

'f', 'c', or 's', indicating structure that is flat, chunked (Ajax), or streaming (Ajax)

Chooses the structure of the output files generated during the export process.

maps to value of SCCOPT_OUTPUT_STRUCTURE option

-r

ResourcePath

ResourcePath is the base URL for .js, .css, and .png assets.

maps to option SCCOPT_URLPATH_RESOURCES

-o

OutputPath

OutputPath is the base URL for links to generated output files.

maps to option SCCOPT_URLPATH_OUTPUT

-s

ScriptUrl

ScriptUrl is a the URL of a javascript file to be linked from the output files.

maps to option SCCOPT_POST_LIBRARY_SCRIPT

-c

CssUrl

CssUrl is the URL of a CSS file to be linked from the output files.

maps to option SCCOPT_EXTERNAL_STYLESHEET

-n

ArchiveNode

ArchiveNode indentifies a node from the input file, to be used as the exported document (applies only to archive files, e.g., .zip)

maps to a record ID parameter passed into DAOpenTreeRecord

-a

AttachmentId

AttachmentId identifies an attachment from the input file, to be used as the exported document (applies only to email message files.)

maps to a subdoc id value to be used in a call to DAOpenSubdocumentById with the id type of DASUBDOCID_ATTACHMENTINDEX

-k

Key, Value

Key and Value are a key/value pair to be made available to scripts

maps to EXAddKeyValue

-f

FontDirectory

FontDirectory indicates where the exporter should find fonts to use.

maps to option SCCOPT_FONTDIRECTORY

demoserver_go

This is a sample server application very similar to the demoserver for node.js. It is written in the Go programming language; compiled executables are included as well as source code. Please see the readme.txt file in this application’s directory for more information.

exsimple

This simple command line driven program allows the user to run a single source file through the software. The user can choose the source file, an output file and set the various options.

To run the program, type:

exsimple *in\_file* *out\_file* *config\_file*

The configuration file is a text file used to set the conversion options. We recommend reading through the configuration file for more information about valid options and their values (use of invalid options results in exsimple not producing output).

Follow these instructions to set configurable options.