Skip to content

FurqanSoftware/toph-printd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Printd

Allow participants to request prints right from within Toph. Process print jobs locally using Printd.

You will have to download Printd and run it on a local computer connected to a printer.

If the computer with the printer has Linux on it, you will need to ensure that CUPS is installed and the printer is configured correctly.

You will also need a configuration file for Printd. This configuration file is contest-specific. You can download this configuration file from Toph once the printing feature is enabled for your contest.

If you have any questions or want to report issues about Printd, please post about it on Toph Community.

Example

An example is included in this repository.

Every page printed is prepended with a header. Prints by participants show the participant number and name or account handle in the header. Test prints show "‹Test Print›" in the header instead.

The contest title, the timestamp of when the print was requested, and page numbers are also included in the header.

Dependencies

Linux:

  • CUPS: Printd uses lpr to dispatch the print job to the printer.

Windows:

  • PDFtoPrinter: Printd uses PDFtoPrinter to dispatch the print job to the printer. Download PDFtoPrinter.exe and put it in the same directory as printd.exe.

Usage

» ./printd -h
  ____       _       _      _ 
 |  _ \ _ __(_)_ __ | |_ __| |
 | |_) | '__| | '_ \| __/ _` |
 |  __/| |  | | | | | || (_| |
 |_|   |_|  |_|_| |_|\__\__,_|

For Toph, By Furqan Software (https://furqansoftware.com)

» Release: -

» Project: https://github.com/FurqanSoftware/toph-printd
» Support: https://community.toph.co/c/support/printd/57

Usage of ./printd:
  -config string
      path to configuration file (default "printd-config.toml")

Configuration

[printd]
fontSize = 13            # In px. All text uses this same font size.
lineHeight = 20          # In px. It must be larger than the font size.
marginTop = 50           # Margin at the top edge of each page.
marginRight = 25         # ... at the right edge of each page.
marginBottom = 50        # ... at the bottom edge of each page.
marginLeft = 25          # ... at the left edge of each page.
tabSize = 4              # Replaces tabs with this many spaces.
headerExtra = ""         # Appends extra text to the page header.
reduceBlankLines = false # Replaces consecutive blank lines with one.
keepPDF = true           # Does not delete generated PDF after print.
delayAfter = "500ms"     # Forces a delay after each print.
delayError = "5s"        # Forces a delay after an error.
logColor = true          # Colors certain parts of the logs.
throbber = true          # Shows an activity throbber below logs.

[printer]
name = ""       # Name of the printer. Leave empty to use the system default.
pageSize = "A4" # Size of the page. Use one of "A4", "letter", or "legal".

[toph]
baseURL = "https://toph.co"
token = "..."               # Collect your Printd token from Toph Support. The token is contest-specific.
contestID = "..."           # The 24-character hex ID of the contest goes here.
timeout = "30s"             # Timeout duration for HTTP client.

Frequently Asked Questions

Prints are missing a few lines of text near the bottom edge of the paper. They don't appear on the next page either. How can I increase the bottom margin of the prints?

This may happen when the printer cannot print content close to the bottom edge of the papers.

Open the configuration file and modify the marginBottom parameter under the [printd] section. Increase the value until enough margin is left so the printer doesn't lose content near the bottom edge of the papers.

If the marginBottom parameter is not present in the configuration file, you may add it under the [printd] section.

Why does Windows show the "This app can't run on your PC" error when running printd.exe?

Please ensure you have downloaded the correct Printd binary for your computer and Windows architecture.

We release Printd binaries for 386, amd64, and arm64 architectures.

Confirm the architecture of Windows you are currently using. Depending on whether you have a 32-bit Windows or a 64-bit Windows, you will have to choose the 386 or amd64 variant, respectively. If you are running Windows on a 64-bit ARM CPU, you will need the arm64 variant.

Windows says, "Windows protected your PC", and prevents Printd from running. What should I do?

"Windows protected your PC." Sure... 👏

To work around this, click the small "More info" link. Then click on the "Run anyway" button.

To-dos

  • Windows support
  • Improve tab-to-spaces behavior