snd

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 1 Imported by: 0

README

Discord

Sales & Dungeons — Thermal Printer as D&D Utility.

With Sales & Dungeons you can create highly customizable handouts, quick reference and much more for your Dungeons and Dragons (or other PnP) Sessions. Most Thermal Printer are small in size and can be taken with you and kept right at the gaming table. Use-cases range from printing out magic items, spells or a letter that the group found to little character sheets of your players to use as DM note. The possibilities are nearly endless!

Warning: This is still rough and early version. If you want to get this working the best way is to jump on the Discord and ask for help.

Screenshot

Features

  • Works on Windows, Mac and Linux
  • Extensive templating system through Nunjucks
  • Various connection methods
    • Windows Direct Printing
    • Raw USB Printing
    • CUPS
    • Serial
  • Import & Export templates and data sources
    • Fast access to external data sources like Open5e (instant access to SRD monsters, spells and more)
  • Edit templates in your favorite editor (e.g. Visual Studio Code) and get live preview

How It Works

Templates: Templates are created in HTML (and CSS) in combination with the Nunjucks templating language. You can imagine the templates as little websites. That makes it possible to use all the nice and convenient layout options that HTML and CSS has to offer and even include any common framework you might need (e.g. Fontawesome for Icons).

Rendered HTML: After creating a template you can create entries with the data you want and print them. Nunjucks will create the rendered HTML from the data you want to print.

Rendered Image: Then this HTML get's converted to a image. Currently this conversion is done by Chrome via the Chrome Debug Protocol. Although Chrome seems like a huge overkill for just HTML-To-Image conversion it's the standard solution at the moment because it supports most of the modern HTML and CSS features.

ESC / POS Commands: The last step before our awesome template hits the Printer is the conversion from the rendered image to the "draw image" command of the printer.

Printer: The generated command will then be sent to the printer and printed. Now your template is ready to be used!

🎉 🎉 🎉

Pre-Build Binaries

Unavailable at the moment.

Printers, Templating & Building

If you want to see what printers were already tested, which settings they need, how the templates work or how you can build Sales & Dungeons yourself please visit the wiki.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildTime string
View Source
var GitBranch string
View Source
var GitCommitHash string

Functions

This section is empty.

Types

type DataSource

type DataSource struct {
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Author      string `json:"author"`
	Description string `json:"description"`
	Version     string `json:"version"`
}

func (DataSource) ID

func (ds DataSource) ID() string

type Entry

type Entry struct {
	ID   string                 `json:"id"`
	Name string                 `json:"name"`
	Data map[string]interface{} `json:"data"`
}

Entry represents one data entry in a template or data source.

type Settings

type Settings struct {
	PrinterType     string `json:"printerType"`
	PrinterEndpoint string `json:"printerEndpoint"`
	PrinterWidth    int    `json:"printerWidth"`
	Commands        struct {
		ExplicitInit      bool `json:"explicitInit"`
		Cut               bool `json:"cut"`
		ForceStandardMode bool `json:"forceStandardMode"`
		LinesBefore       int  `json:"linesBefore"`
		LinesAfter        int  `json:"linesAfter"`
	} `json:"commands"`
	Stylesheets []string `json:"stylesheets"`
}

Settings represents the basic settings for S&D.

type Template

type Template struct {
	Name          string                 `json:"name"`
	Slug          string                 `json:"slug"`
	Author        string                 `json:"author"`
	Description   string                 `json:"description"`
	PrintTemplate string                 `json:"printTemplate"`
	ListTemplate  string                 `json:"listTemplate"`
	SkeletonData  map[string]interface{} `json:"skeletonData"`
	DataSources   []string               `json:"dataSources"`
	Version       string                 `json:"version"`
}

Template represents one S&D template

func (Template) ID

func (t Template) ID() string

Directories

Path Synopsis
cups
Package cups provides printing for Sales & Dungeons via cups.
Package cups provides printing for Sales & Dungeons via cups.
remote
Package remote provides printing for Sales & Dungeons via a remote endpoint.
Package remote provides printing for Sales & Dungeons via a remote endpoint.
usb
Package usb provides printing for Sales & Dungeons via USB.
Package usb provides printing for Sales & Dungeons via USB.
windows
Package windows provides printing for Sales & Dungeons via direct printing on windows.
Package windows provides printing for Sales & Dungeons via direct printing on windows.
thermalprinter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL