Skip to content

Attacler/TextToAnything-JS

Repository files navigation

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

Usage

  1. Add the TTA package:
npm i @texttoanything/nodets
deno add jsr:@texttoanything/deno
  1. 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

  1. Add the TTA package:

NodeJS:

npm i @texttoanything/nodets

Deno:

deno add jsr:@texttoanything/deno
  1. 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*/);
  1. Scan a file
const result = await TTAVirusScanner.scanFile(file, "image/jpg");

console.log(result);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published