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

applidok

v1.0.4

Published

Client API for Applidok PDF templating

Downloads

4

Readme

Node.js client API for Applidok

This Node.js API allows to call PDF templating features exposed by Applidok.

Get started

This package can be installed as NPM package: npm install applidok

Then applidok module can be required in your Node.js code: var applidok = require("applidok")

The main function to merge data (e.g. form submission) with PDF template managed on Applidok is applidok.merge:

var applidok = require("applidok");

applidok.merge(options/* see details bellow */);

Example

Some examples using this module are available in the repository: see simple example.

var applidok = require("applidok");

applidok.merge({
    // Mandatory options
    token:"a610e9b1048499110433bb790489303a07182aac"/*replace by your token*/,
    template:"ca62e08d-2082-4cd4-837c-d46a362091e3"/*replace by your template*/,
    success: function(res){ // Success handler
        console.log("Will save merged document as document.pdf file");
        res.pipe(fs.createWriteStream("document.pdf"));
    },
    error: function(httpStatus){ // Optional, custom error handler
        console.error("Oups! Got an error: " + httpStatus)
    },
    parameters: { // Name-value pairs corresponding to template areas
        'firstName': "First name"
    }
});

API reference

The module is exposing following Applidok functions.

merge

.merge(options): Merge values with specified template; Object options is expecting following properties.

  • token: Applidok application token (string).
  • template: ID of Applidok template (string).
  • parameters: Name/value pairs to be merged with areas (object).
  • success: Success callback, is given a HTTP response as argument; Optional function, if undefined default handler (console.log) is used.
  • error: Error callback, is given HTTP error code (int) as argument; Optional function, if undefined default handler (console.error) is used.

Application token and template ID are visible in Integration tab on Template screen of Applidok management.

See code sample

auth

.auth(options): Authenticate and get the administration token to be able to manage the corresponding Applidok account.

  • email: Applidok login (string).
  • password: Applidok password (string, cleartext)
  • success: Success callback, is given the admin token as argument; Optional, if undefined default handler (console.log) is used.
  • error: Error callback, is given error details as argument (e.g. {'code':123, 'cause':"Error cause"}; Optional, if undefined default handler (console.error) is used.

See code sample

Template list

.templateList(options): List the templates of Applidok account specified by the given administration token.

var dok = require("applidok");

dok.templateList({
    // replace by your admin token, see `dok.auth`
    token: "c64ca212064c8588b9c5f4a2d9165399b99aa83c",
    success: function(res){ // Success handler
        // res = http://nodejs.org/api/http.html#http_event_response
        console.log("List of Applidok templates: " + JSON.stringify(res));
    },
    error: function(httpStatus){ // Optional, custom error handler
        console.error("Oups! Got an error: " + httpStatus)
    }
});

The success handler is given an object with following properties.

```javascript
{
  "token": "app_token",
  "activePlan": { "credits":1 },
  "templates": [
    { "id": "tmpl-1", "name": "Template #1", "expiration":1418833775372 },
    { "id": "tmpl-2", "name": "Second template" },
    { "id": "tmpl-3", "name": "The third one" },
    { "id": "tmpl-4", "name": "Template #4",
      "expiration":1418228986489, "trial":true }
  ]
}