@onedoc/client
TypeScript icon, indicating that this package has built-in type declarations

0.1.33 • Public • Published

@onedoc/client

Installation

Onedoc is available as an npm package.

npm install @onedoc/client

Usage

Below is the simplest example of using Onedoc to render a PDF from HTML. It outputs the PDF to a file called test.pdf.

import { Onedoc } from "@onedoc/client";
import { writeFileSync } from "fs";

const onedoc = new Onedoc("xxx-xxx-xxx-xxx"); // your API key

const { file, error, info } = await onedoc.render({
  html: "<h1 style='color: red;'>Hello world!</h1>",
  assets: [],
});

if (error) {
  throw error;
}

writeFileSync("./test.pdf", Buffer.from(file), "binary");

Documentation

For more information, please visit our documentation.

Support

For any questions or feature requests, please get in touch on Discord.

Readme

Keywords

none

Package Sidebar

Install

npm i @onedoc/client

Weekly Downloads

218

Version

0.1.33

License

ISC

Unpacked Size

40.5 kB

Total Files

16

Last publish

Collaborators

  • titou325