
Security News
PolinRider: North Korea-Linked Supply Chain Campaign Expands Across Open Source Ecosystems
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.
react-native-printer-usb
Advanced tools
React Native module to print on USB thermal printers (ESC/POS) for Android. Supports text, images (base64/URL), barcodes, QR codes, HTML, and raw commands. Handles accented characters, alignment, font, cut, beep, underline, and more.
npm install react-native-printer-usb
AndroidManifest.xml:<uses-feature android:name="android.hardware.usb.host" />
<uses-permission android:name="android.permission.USB_PERMISSION" />
import { getList } from 'react-native-printer-usb';
const devices = getList();
// [{ vendorId, productId, deviceId, manufacturerName, productName, serialNumber, deviceName }]
import { printText } from 'react-native-printer-usb';
await printText({
text: 'Olá, mundo! Çãõé',
productId, // required
align: 'center', // 'left' | 'center' | 'right'
encoding: 'CP850', // or 'utf8', 'ISO-8859-1', etc.
bold: true,
underline: true,
font: 'A', // 'A' | 'B' | 'C'
size: 2, // 1 (normal), 2 (2x), 4 (4x)
cut: true, // cut paper after print
beep: true, // beep after print
tailingLine: true, // add blank lines at end
});
import { printImageBase64, printImageUri } from 'react-native-printer-usb';
await printImageBase64({ base64Image, productId, align: 'center' });
await printImageUri({ imageUri: 'https://...', productId, align: 'center' });
import { barCode, qrCode } from 'react-native-printer-usb';
await barCode({ text: '123456789012', productId, width: 2, height: 80 });
await qrCode({ text: 'https://reactnative.dev', productId, size: 6, align: 'center' });
import { printHtml } from 'react-native-printer-usb';
await printHtml({
html: '<h1>Impressão HTML</h1>',
productId,
align: 'center',
htmlHeight: 760, // px (optional)
});
import { sendRawData } from 'react-native-printer-usb';
await sendRawData({
productId,
text: '\x1B\x40Hello\n', // ESC/POS commands
cut: true,
tailingLine: true,
encoding: 'utf8',
});
import { printCut, reset } from 'react-native-printer-usb';
await printCut(true, true, productId); // cut, beep, productId
await reset(productId);
| Option | Type | Description |
|---|---|---|
| text | string | Text to print |
| productId | number | USB Product ID (required) |
| align | string | 'left', 'center', 'right' |
| encoding | string | 'utf8', 'CP850', 'ISO-8859-1', etc. |
| bold | boolean | Bold text |
| underline | boolean | Underline text |
| font | string | 'A', 'B', 'C' |
| size | number | 1 (normal), 2 (2x), 4 (4x) |
| cut | boolean | Cut paper after print |
| beep | boolean | Beep after print |
| tailingLine | boolean | Add blank lines at end |
| base64Image | string | PNG/JPG base64 image (for printImageBase64) |
| imageUri | string | Image URL (for printImageUri) |
| html | string | HTML string (for printHtml) |
| htmlHeight | number | Height in px for HTML print (optional) |
See example/App.tsx for a full-featured demo with device selection, all print types, and UI/UX best practices.
cut/beep.See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
FAQs
React Native module to print on USB thermal printers
The npm package react-native-printer-usb receives a total of 3 weekly downloads. As such, react-native-printer-usb popularity was classified as not popular.
We found that react-native-printer-usb demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
PolinRider expands across npm, Packagist, Go modules, and Chrome extensions, using hidden loaders to target developer environments.

Security News
Open source attacks are accelerating as AI coding agents pull in dependencies faster, with less human review.

Research
/Security News
Malicious Chrome and Firefox extensions posed as free VPNs while stealing clipboard data through later extension updates.