npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@asposecloud/aspose-html-cloud

v22.12.1

Published

Aspose.Html Cloud Node.js SDK

Downloads

22

Readme

Aspose.Html Cloud Node.js SDK

Aspose.Html Cloud is a true REST API that enables you to perform a wide range of html processing operations including manipulation and conversion in the cloud, with zero initial costs. Our Cloud SDKs are wrappers around REST API in various programming languages, allowing you to process html pages in language of your choice quickly and easily, gaining all benefits of strong types and IDE highlights.

  • API version: 22.12.1
  • Package version: 22.12.1

Possible conversions:

  • HTML -> PDF, XPS, DOCX, MD, MHTML, JPEG, BMP, PNG, TIFF, GIF
  • EPUB -> PDF, XPS, DOCX, JPEG, BMP, PNG, TIFF, GIF
  • MD -> PDF, XPS, DOCX, HTML, MHTML, JPEG, BMP, PNG, TIFF, GIF
  • MHTML -> PDF, XPS, DOCX, JPEG, BMP, PNG, TIFF, GIF
  • SVG -> PDF, XPS, JPEG, BMP, PNG, TIFF, GIF
  • JPEG, BMP, PNG, TIFF, GIF -> SVG

Installation

Aspose.HTML Cloud SDK for Node.js

This repository contains Aspose.HTML Cloud SDK for Node.js source code. This SDK allows you to work with Aspose.HTML Cloud REST APIs in your Node.js applications quickly and easily.

See API Reference for full API specification.

How to use the SDK?

The complete source code is available in this repository folder, you can either directly use it in your project via npm package manager.

Prerequisites

To use Aspose HTML for Cloud Node.js SDK you need to register an account with Aspose Cloud and lookup/create App Key and SID at Cloud Dashboard. There is a free quota available. For more details, see Aspose Cloud Pricing.

Install Aspose.HTML Cloud

For Node.js

npm

npm install @asposecloud/aspose-html-cloud --save

git

Install it via:

    npm install https://github.com/aspose-html-cloud/aspose-html-cloud-nodejs --save

Getting Started

  1. Sign Up. Before you begin, you need to sign up for an account on our Dashboard and retrieve your credentials.
  2. Minimum requirements. This SDK requires Node.js 6.x and higher.
  3. Install Aspose.Html Cloud Node.js SDK.

Please, add the following nmp package to your project.json as a dependency.

{
  "dependencies": {
    "@asposecloud/aspose-html-cloud":"^22.12.1"
  }
}

Please follow the installation instruction and execute the following JS code:

NOTE: Use the helper from /test/helper.js for an upload and save data.


    // Get keys from aspose site.
    // There is free quota available. 
    // For more details, see https://purchase.aspose.cloud/pricing
	
var conf = {
    "basePath":"https://api.aspose.cloud/v4.0",
    "authPath":"https://api.aspose.cloud/connect/token",
    "apiKey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "defaultUserAgent":"NodeJsWebkit"
};

var api = require('@asposecloud/aspose-html-cloud');

// Create Conversion Api object
var conversionApi = new api.ConversionApi(conf);


var src = "/path/to/src/test.html"; // {String} Source document.
var dst = "/path/to/dst/test.jpeg"; // {String} Result document.


//Setup various option for result image
var opts = {
  'width': 800, // {Number} Resulting image width in pixels.
  'height': 1000, // {Number} Resulting image height in pixels.
  'leftMargin': 10, // {Number} Left resulting image margin in pixels.
  'rightMargin': 10, // {Number} Right resulting image margin in pixels.
  'topMargin': 20, // {Number} Top resulting image margin in pixels.
  'bottomMargin': 20 // {Number} Bottom resulting image margin in pixels.

};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log(data);  
  }
};

conversionApi.convertLocalToLocal(src, dst, opts, callback);
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your package from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('@asposecloud/aspose-html-cloud') in javascript files from the directory you ran the last command above from.

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Sample usage

Before fill all fields in configuration object (see tests)

Example:

var conf = {
    "basePath":"https://api.aspose.cloud/v4.0",
    "authPath":"https://api.aspose.cloud/connect/token",
    "apiKey":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "appSID":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "defaultUserAgent":"Webkit"
}

Documentation for API Endpoints

All URIs are relative to https://api.aspose.cloud/v4.0

Tests contain various examples of using the Aspose.HTML SDK.

CONVERSION API

  • For conversion to images allowed formats is jpeg, png, bmp, tiff, gif. Input formats are html, epub, svg.

| Class | Method | Description | |---------------------------------|------------------------------------------------------------------------------|-----------------------------------------------------------| | Asposehtmlcloud.ConversionApi | convertLocalToLocal | Convert a document from local disk to a local disk. | | Asposehtmlcloud.ConversionApi | convertLocalToStorage | Convert a document from local disk to user's storage. | | Asposehtmlcloud.ConversionApi | convertStorageToLocal | Convert a document from user's storage to local disk. | | Asposehtmlcloud.ConversionApi | convertStorageToStorage | Convert a document from user's storage to user's storage. | | Asposehtmlcloud.ConversionApi | convertUrlToLocal | Convert the HTML document by URL to local disk. | | Asposehtmlcloud.ConversionApi | convertUrlToStorage | Convert the HTML document by URL to user's storage. | | Asposehtmlcloud.ConversionApi | convert | Convert a document to the specified format. |

VECTORIZATION API

| Class | Method | Description | |------------------------------------|-------------------------------------------------------------------------------------|---------------------------------------------------------------| | Asposehtmlcloud.VectorizationApi | vectorizeLocalToLocal | Vectorization an image from local disk to a local disk. | | Asposehtmlcloud.VectorizationApi | vectorizeLocalToStorage | Vectorization an image from local disk to user's storage. | | Asposehtmlcloud.VectorizationApi | vectorizeStorageToLocal | Vectorization an image from user's storage to local disk. | | Asposehtmlcloud.VectorizationApi | vectorizeStorageToStorage | Vectorization an image from user's storage to user's storage. | | Asposehtmlcloud.VectorizationApi | vectorize | Vectorization an image to the specified format. |

STORAGE API

| Class | Method | HTTP request | Description | |------------------------------|-------------------------------------------------------|-------------------------------------|-------------------------------------------| | Asposehtmlcloud.StorageApi | deleteFile | DELETE /html/file | Delete file | | Asposehtmlcloud.StorageApi | downloadFile | GET /html/file | Download file | | Asposehtmlcloud.StorageApi | uploadFile | POST /html/file | Upload file | | Asposehtmlcloud.StorageApi | createFolder | POST /html/folder | Create the folder | | Asposehtmlcloud.StorageApi | deleteFolder | DELETE /html/folder | Delete folder | | Asposehtmlcloud.StorageApi | getFilesList | GET /html/folder | Get all files and folders within a folder | | Asposehtmlcloud.StorageApi | getDiscUsage | GET /html/storage/disc | Get disc usage | | Asposehtmlcloud.StorageApi | objectExists | GET /html/storage/exist | Check if file or folder exists | | Asposehtmlcloud.StorageApi | storageExists | GET /html/storage/exist/storage | Check if storage exists |

Documentation for Models

Run tests

node.exe ./node_modules/mocha/bin/_mocha --ui bdd ./test

Documentation for Authorization

Please follow the installation instruction for write config file.