How to PDF to HTML in JavaScript using Cloud API (low level)

  • Home
  • /
  • Articles
  • /
  • How to PDF to HTML in JavaScript using Cloud API (low level)

These sample code snippets show how to convert PDF to HTML in JavaScript using ByteScout Cloud API (low level).

You can also convert HTML to PDF in JavaScript.

POST/GET endpoint:

Code Sample:

var Bytescoutio = require('bytescoutio');
var defaultClient = Bytescoutio.ApiClient.instance;

// Configure API key authorization: api_key
var api_key = defaultClient.authentications['api_key'];
api_key.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//api_key.apiKeyPrefix['x-api-key'] = "Token"

var api = new Bytescoutio.DefaultApi()

var opts = { 
  'simple': simple_example, // {String} Set 'true' to convert to a plain HTML format. Default is the rich HTML & CSS format keeping the document design.
  'columns': columns_example, // {String} Set 'true' if the PDF document is arranged in columns like a newspaper. Default is 'false'.
  'url': url_example, // {String} URL of the source PDF file.
  'name': name_example // {String} File name for generated result.

var callback = function(error, data, response) {
  if (error) {
  } else {
    console.log('API called successfully. Returned data: ' + data);
api.pdfConvertToHtmlPost(opts, callback);