@texttoanything/nodets
v0.0.4
Published
This package is a wrapper around the TextToAnything API without using any external dependencies. <br> You can join our Discord incase you need support: [Discord](https://discord.gg/dbEWUHGmnr)
Readme
TextToAnything-JS
This package is a wrapper around the TextToAnything API without using any external dependencies. It allows you to easily generate PDF`s, QRCodes or barcodes. This package will return a File object which you can use however you like. You can join our Discord incase you need support: Discord Compatible with NodeJS (Typescript) and Deno (Deploy).
Requirements
- For the virusscanner: you can get the API token here
- For the other features: you can get the API token here
Usage
- Add the TTA package:
NodeJS:
npm i @texttoanything/nodetsdeno add jsr:@texttoanything/deno- Initialize TTA:
NodeJS:
import { TextToAnything } from "@texttoanything/nodets";
const TTA = new TextToAnything(/*API token here*/);Deno:
import { TextToAnything } from "@texttoanything/deno";
const TTA = new TextToAnything(/*API token here*/);Your done setting up!
Generating a PDF from a template
Keep in mind that you will need to link your account. See this article for more information.
const PDF = await TTA.generatePDFFromTemplate("test.pdf", 10, {
name: "World!"
});Generating a PDF
const PDF = await TTA.generatePDF("test.pdf", {
header: "Header HTML", // optional
html: "<h1>Hello world!</h1>",
footer: "Footer HTML", // optional
landscape: false, // false -> portrait, true -> landscape mode (default)
format: "A4",
});Generating a Barcode
const barcode = await TTA.generateBarcode("barcode.png", {
content: "Test-12345",
type: "code128",
includeText: true,
});Generating a QRCode
const qrcode = await TTA.generateQRCode("qrcode.png", {
content: "https://rapidapi.com/Attacler/api/text-to-anything",
});Using OCR on a file
const ocrText = await TTA.OCR(file, "eng", "image/jpeg", "text");Virusscanner
- Add the TTA package:
NodeJS:
npm i @texttoanything/nodetsDeno:
deno add jsr:@texttoanything/deno- Initialize TTA:
NodeJS:
import { TextToAnythingVirusScanner } from "@texttoanything/nodets";
const TTAVirus = new TextToAnythingVirusScanner(/*Virusscanner API token here*/);Deno:
import { TextToAnythingVirusScanner } from "@texttoanything/deno";
const TTAVirus = new TextToAnythingVirusScanner(/*Virusscanner API token here*/);- Scan a file
const result = await TTAVirusScanner.scanFile(file, "image/jpg");
console.log(result);