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";constTTA=newTextToAnything(/*API token here*/);Deno:
import{TextToAnything}from"@texttoanything/deno";constTTA=newTextToAnything(/*API token here*/);Your done setting up!
Keep in mind that you will need to link your account. See this article for more information.
constPDF=awaitTTA.generatePDFFromTemplate("test.pdf",10,{name: "World!"});constPDF=awaitTTA.generatePDF("test.pdf",{header: "Header HTML",// optionalhtml: "<h1>Hello world!</h1>",footer: "Footer HTML",// optionallandscape: false,// false -> portrait, true -> landscape mode (default)format: "A4",});constbarcode=awaitTTA.generateBarcode("barcode.png",{content: "Test-12345",type: "code128",includeText: true,});constqrcode=awaitTTA.generateQRCode("qrcode.png",{content: "https://rapidapi.com/Attacler/api/text-to-anything",});constocrText=awaitTTA.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";constTTAVirus=newTextToAnythingVirusScanner(/*Virusscanner API token here*/);Deno:
import{TextToAnythingVirusScanner}from"@texttoanything/deno";constTTAVirus=newTextToAnythingVirusScanner(/*Virusscanner API token here*/);- Scan a file
constresult=awaitTTAVirusScanner.scanFile(file,"image/jpg");console.log(result);