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).
- For the virusscanner: you can get the API token here
- For the other features: you can get the API token here
- Add the TTA package:
npm i @texttoanything/nodets
deno 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!
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!"
});
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",
});
const barcode = await TTA.generateBarcode("barcode.png", {
content: "Test-12345",
type: "code128",
includeText: true,
});
const qrcode = await TTA.generateQRCode("qrcode.png", {
content: "https://rapidapi.com/Attacler/api/text-to-anything",
});
const ocrText = await TTA.OCR(file, "eng", "image/jpeg", "text");
- Add the TTA package:
NodeJS:
npm i @texttoanything/nodets
Deno:
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);