Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-pdf/textkit

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf/textkit

An advanced text layout framework

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
597K
increased by3.22%
Maintainers
1
Weekly downloads
 
Created

What is @react-pdf/textkit?

@react-pdf/textkit is a low-level text layout engine for React PDF. It provides tools for text shaping, line breaking, and text rendering, making it easier to handle complex text layouts in PDF documents.

What are @react-pdf/textkit's main functionalities?

Text Shaping

Text shaping involves converting a string of text into a series of positioned glyphs. This is essential for rendering text accurately in PDFs.

const Textkit = require('@react-pdf/textkit');
const font = new Textkit.Font('path/to/font.ttf');
const glyphs = font.layout('Hello, world!');
console.log(glyphs);

Line Breaking

Line breaking is the process of dividing text into lines that fit within a given width. This is crucial for creating readable and well-formatted text blocks in PDFs.

const Textkit = require('@react-pdf/textkit');
const lineBreaker = new Textkit.LineBreaker();
const breaks = lineBreaker.break('This is a long text that needs to be broken into lines.', 100);
console.log(breaks);

Text Rendering

Text rendering involves drawing the shaped and positioned glyphs onto a canvas or PDF. This is the final step in displaying text in a PDF document.

const Textkit = require('@react-pdf/textkit');
const renderer = new Textkit.Renderer();
const text = 'Hello, world!';
const renderedText = renderer.render(text, { x: 0, y: 0 });
console.log(renderedText);

Other packages similar to @react-pdf/textkit

FAQs

Package last updated on 23 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc