1.0.5 • Published 4 years ago
@youngmayor/pidifier-sdk v1.0.5
pidifier
A node wrapper for the pidifier API
Table of Contents
Features
- Creates a programmable API for interacting with the pidifier API
- Well documented methods
Browser Support
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
---|---|---|---|---|---|
Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |
Installing
Using npm:
$ npm install @youngmayor/pidifier-sdk
Using bower:
$ bower install @youngmayor/pidifier-sdk
Using yarn:
$ yarn add @youngmayor/pidifier-sdk
Using jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/@youngmayor/pidifier-sdk@latest"></script>
Using unpkg CDN:
<script src="https://unpkg.com/@youngmayor/pidifier-sdk"></script>
Importing
- In a node based application, you can import the package using commonJS as shown below
const pidify = require('@youngmayor/pidifier-sdk');
// or
import pidify from '@youngmayor/pidifier-sdk';
// pidify.<method> will now provide autocomplete and parameter typings
- It can also be linked to using any of the below citizens
<script src="https://cdn.jsdelivr.net/npm/@youngmayor/pidifier-sdk@latest" async></script>
<!-- or -->
<script src="https://unpkg.com/@youngmayor/pidifier-sdk" async></script>
the package can now be accessed via window.pidify
Usage
Getting page's PDF as a Base 64 Content:
- To retrieve the Base 64 encoding of a converted page, the
getBase64(url)
method can be used
// ...
const base64Data = await pidify.getBase64(url)
// ...
Getting page's PDF as a Blob
- To retrieve the PDF Blob of a converted page, the
getAsPdfBlob(url)
method can be used
// ...
const blobData = await pidify.getAsPdfBlob(url)
// ...
Downloading the PDF
- The wrapper also performs task of rendering the data / blob url into a PDF file using
downloadPDF(url)
method can be used.This method collects as a second parameter, the name to use in downloading the file
// ...
await pidify.downloadPDF(url, fileName)
// ...