pdfkiwi-node
A node library for interacting with pdf.kiwi API
Installation
# - Npm npm install pdfkiwi --save # - Yarn yarn add pdfkiwi
Usage
Start by instantiating a client instance:
const pdf = ; const client = '[api email]' 'api token';
You can then use any of the methods described below.
- Available options (for the
options
parameters) are listed on this page. - API error codes are listed on this page.
- All of these methods return a promise.
- The promise is resolved with a
Buffer
containing the PDF binary data,
You can use built-in utility functions to save or download the pdf directly.
(see Built-in utility functions)
.convertHtml()
- Convert HTML string to PDF
Pdfkiwi: Promise
Exemple:
client ;
Built-in utility functions
pdf.saveToFile()
— Saves the generated PDF to a file.
pdf: Function
- If the
filePath
has no extension, the.pdf
extension will be automatically appended. - The
filePath
path is resolved regarding the current working directory.
Exemple:
client ;
pdf.sendHttpResponse()
— Returns the generated PDF in an HTTP response.
pdf: Function
- If the
fileName
has no extension, the.pdf
extension will be automatically appended.
Exemple:
const express = ;const app = ; app; app;
Useful links
- https://pdf.kiwi
- https://doc.pdf.kiwi — API Documentation