View Document

Converts a document to HTML format for viewing in a Web browser.

The View Document API renders documents into HTML, and highlights text in the document. It uses HPE KeyView to extract the contents of over 500 different file formats, and convert them to HTML (for more information, see Supported Formats).

Quick Start

You can use the View Document API to return the contents of both HTML pages and non-HTML files in a browser-friendly, consistent HTML format. It can render publicly hosted HTTP(S) content, or an uploaded target file.

Note: API input is subject to a maximum size quota. If you upload text or a file that is too large, the API returns an error. For more information, see Rate Limiting, Quotas, Data Expiry, and Maximums.

curl -X POST[sync|async]/viewdocument/v1 --form "file=@myfile.pdf"

It embeds images and other media in the response output to ensure that the returned HTML is self-contained.

    <meta name="Author" content="HPE" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<div style="position:absolute;top:24px;left:21px;white-space:nowrap;"><img src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/

By default the raw_html parameter is set to true, and the API returns HTML directly. You can set this parameter to false to return the base64 encoded version of the HTML, wrapped in JSON. For example:

curl -X POST[sync|async]/viewdocument/v1 --form "file=@myfile.pdf" --form "raw_html=false"

  "document": "PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMC8vRU4iPgo8aHRtbD4KPGhlYWQ+CiAgICA8bWV0YSBuYW1lPSJBdXRob3IiIGNvbnRlbnQ9IiIgLz4KICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04IiAvPgo8L2hlYWQ+Cjxib2R5Pgo8cCBzdHlsZT0idGV4dC1hbGlnbjpsZWZ0O21hcmdpbi10b3A6MC4wMGluO21hcmdpbi1ib3R0b206MC4wMGluOyI+Cjxmb250IHN0eWxlPSJmb250LXNpemU6MTJwdDsiPkkgbGlrZSBjYXRzPC9mb250Pgo8L3A+CjwvYm9keT4KPC9odG1sPg=="


When you submit a file or URL to convert, you can optionally specify terms that you want to surround with a specified tag, for highlighting or other purposes.

curl -X POST[sync|async]/viewdocument/v1 --form "file=@myfile.pdf" --form "highlight_expression=IDOL" --form "start_tag=<b>"

The API adds a specified HTML tag around the highlighted terms.

<div style="position:absolute;top:1808px;left:295px;font-size:9pt;white-space:nowrap;"><b>IDOL</b> 10 powers many of the applications that depend upon an understanding of human

You can send multiple highlight_expression and start_tag pairs as post parameters. The order determines the pairings.

curl -X POST[sync|async]/viewdocument/v1 --form "file=@myfile.pdf" --form "highlight_expression=IDOL" --form "start_tag=<b>" --form "highlight_expression=patents" --form "start_tag=<u>"

You can use the Try page to see examples of renderings and to try your own.


This API requires an authentication token to be supplied in the following parameter:

Parameter Description
apikey The API key to use to authenticate the API request.

This API accepts the following parameters:

Name Type Description
binary A file containing the document to view. Multipart POST only.
string A Haven OnDemand reference obtained from either the Expand Container or Store Object API. The corresponding document is passed to the API.
string A publicly accessible HTTP URL that you want to view.
Name Type Description
array<string> The closing HTML tag to use to highlight a link term. If omitted, the end_tag is generated automatically from the start_tag. If specified, the number of end tags must match the number of highlight expressions.
array<string> The terms to highlight in the document. You can also use Boolean expressions, for example, term1 AND term2. You can specify the terms and expressions as a single string, or in an array. If you use an array, you can specify an array for the start_tag parameter, to highlight each array item in a different color or format. If you specify start_tag, the number of tags must match the number of highlight expressions.
boolean Set to true to output HTML suitable for direct rendering in a Web browser. Set to false to output base64-encoded HTML wrapped in a JSON object. Default value: true.
array<string> The opening HTML tag to use to highlight a link term. If specified, the number of start tags must match the number of highlight expressions. The default value is <span style="background-color: yellow">.

This API returns a JSON response that is described by the model below. This single model is presented both as an easy to read abstract definition and as the formal JSON schema.

Asynchronous Use

Additional requests are required to get the result if this API is invoked asynchronously.

You can use /1/job/status/<job-id> to get the status of the job, including results if the job is finished.

You can also use /1/job/result/<job-id>, which waits until the job has finished and then returns the result.

This is an abstract definition of the response that describes each of the properties that might be returned.
View Document Response {
document ( string ) The base64-encoded HTML version of the document, if raw_html is set to false.
Model Schema
This is a JSON schema that describes the syntax of the response. See for a complete reference.
    "properties": {
        "document": {
            "type": "string"
    "required": [
    "type": "object"
If raw_html is set to true then a Raw HTML page is directly returned without a JSON schema, suitable for direct rendering in a Web browser
See this API for yourself - select one of our examples below.
Render a PDF Document
Render a PDF Document and highlight 'IDOL'
Render a Word Document
Render a Word Document and highlight 'Hewlett, Packard, HP'
Render a web page
Render HPE's Wikipedia entry and highlight 'Hewlett, Packard, HPE'
Select file Change Remove
Name Type Value
Add another value
Add another value
(Default: True)
Add another value

ASync – Response An error occurred making the API request
Response Code:
Response Body

Making API Request…
Checking result of job

To try this API with your own data and use it in your own applications, you need an API Key. You can create an API Key from your account page - API Keys.

Output Refresh An error occurred making the API request View Input
Rendered RawHtml Response
Result Display
Response Code:
Response Body:

Make this call with curl

If you would like to provide us with more information then please use the box below:

We will use your submission to help improve our product.