FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
dcm31
dcm31paperang_printer
Web Bluetooth interface for Paperang P1 thermal printer
Public
Like
paperang_printer
Home
Code
3
backend
1
frontend
5
S
README.md
Branches
2
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ€“ all from the browser, and deployed in miliseconds.
Sign up now
Code
/
Code
/
Search
README.md

Paperang P1 Web Bluetooth Printer

A web-based interface for printing to Paperang P1 thermal printers using the Web Bluetooth API.

Features

  • ๐Ÿ” Bluetooth Scanner - Find nearby Paperang printers
  • ๐Ÿ”— Easy Connection - Connect via MAC address or device search
  • ๐Ÿ“ Text Printing - Print text with adjustable font sizes
  • ๐Ÿ“… Timestamped Notes - Automatically add timestamp to notes
  • ๐Ÿ’พ MAC Storage - Save printer address for quick reconnection
  • ๐Ÿงช Self Test - Built-in printer diagnostics
  • ๐Ÿ“Š Debug Logs - Comprehensive logging for troubleshooting

Usage

  1. Connect to Printer

    • Click "Scan for Printers" to find nearby Paperang devices
    • Or enter MAC address manually
    • Click "Connect" to establish Bluetooth connection
    • Save MAC address for future use
  2. Print Text

    • Enter text in the text area
    • Adjust font size with slider (12-48px)
    • Click "Print Text" or "Print Note w/ Timestamp"
  3. System Functions

    • Use "Self Test" to verify printer functionality
    • "Feed Paper" advances paper for tearing
    • "Test Connection" verifies Bluetooth link

Browser Requirements

  • Chrome, Edge, or Opera (Web Bluetooth API support required)
  • HTTPS connection (required for Bluetooth access)
  • Desktop or Android (iOS doesn't support Web Bluetooth)

Troubleshooting

  • Check debug logs for detailed error information
  • Ensure printer is on and in pairing mode
  • Keep printer within 3 feet of computer
  • Don't pair printer in OS Bluetooth settings (use app only)

Project Structure

โ”œโ”€โ”€ backend/
โ”‚   โ””โ”€โ”€ index.ts          # Hono server with MAC storage API
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ index.html        # Main UI
โ”‚   โ”œโ”€โ”€ protocol.js       # Paperang protocol implementation
โ”‚   โ”œโ”€โ”€ connection.js     # Bluetooth connection management
โ”‚   โ”œโ”€โ”€ printing.js       # Text printing and bitmap conversion
โ”‚   โ””โ”€โ”€ utils.js          # Storage and utility functions
โ””โ”€โ”€ README.md

Technical Details

  • Uses Web Bluetooth API for printer communication
  • Implements Paperang P1 protocol with CRC32 validation
  • Converts text to 384px wide 1-bit bitmaps
  • Stores MAC addresses server-side using Val Town blob storage
  • Modular JavaScript architecture for maintainability
Code
backendfrontend
S
README.md
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.