Hacker News new | ask | show | jobs
by corytheboyd 516 days ago
Is there something out there like this that is self-hosted? It’s ridiculous that this isn’t, and it’s going to become a pay-per-print model?! I don’t care about the AI nonsense, it’s a printer.

I could see myself using something like this to print recipes. I’d like to avoid getting my fancy cook book dirty, but have still have recipe in the kitchen to reference. Phone works okay until you have to scroll with dirty/wet hands.

5 comments

<?php

// Hardcoded token for authentication $authToken = 'your-secure-token-here';

// Set the printer name (adjust to your printer's name) $printerName = 'YourPrinterName';

// Allow only POST requests if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); echo json_encode(['error' => 'Method not allowed. Use POST.']); exit; }

// Check for token in the request if (empty($_POST['token']) || $_POST['token'] !== $authToken) { http_response_code(401); echo json_encode(['error' => 'Unauthorized: Invalid token.']); exit; }

// Check if a file was uploaded if (empty($_FILES['file']) || $_FILES['file']['error'] !== UPLOAD_ERR_OK) { http_response_code(400); echo json_encode(['error' => 'No file uploaded or file upload error.']); exit; }

// Get the uploaded file path $uploadedFile = $_FILES['file']['tmp_name']; $fileName = basename($_FILES['file']['name']);

// Use lp command to print the file $command = escapeshellcmd("lp -d " . escapeshellarg($printerName) . " " . escapeshellarg($uploadedFile)); exec($command, $output, $status);

// Check the status of the command if ($status === 0) { http_response_code(200); echo json_encode(['success' => "File '$fileName' sent to printer '$printerName'."]); } else { http_response_code(500); echo json_encode(['error' => 'Failed to print the file.']); }

I don’t think you can just send any document to a thermal printer and have it come out usable… there’s definitely value in software that can _convert_ arbitrary data to whatever format/dimensions/etc the thermal printer needs. Like the post mentions automatic dithering of images. Stuff like that. The HTTP glue is not the hard part.
I was surprised by this, but you can install a driver and simply print to these printers. Or, at least, the one I purchased is that way.

You can also use lp, lpr, or nc to send text and codes to it.

Mine is connected to my network via Ethernet. No RPi is required to send stuff to it from any computer on the network.

I imagine the software presented here does a lot more than proxy requests to a printer though. What sorts of payloads were you sending off to be printed? If it worked Good Enough for lightly formatted text, no-hosted is way better than self-hosted!
I was printing two things...

1. A plain text "progress report" that tells me some personal stats about my week last week.

2. Full designs created in Affinity Designer, which print with the simple "print" menu. These can have any font, graphic, or whatever.

I was able to send everything from plain text with a scroll and cut ESC/POS command on the end (my automated progress report), to an image sent directly to the printer queue, to a pixel perfect desktop design document.

> I could see myself using something like this to print recipes.

The home equivalent of a fast food kitchen ticket printer!

I think this is a fun little project, but only until people discover how annoying thermal printers are in actual use, combining all the user-hostility of printers with a tiny form factor.

If you want a really unique gimmick, you can get wireless bluetooth thermal printers that have belt loops. Intended as table-side receipt printers for waitstaff or ticket printers for transit.

Another unique feature receipt printers often have that regular ones don't: a 24V pulse "kicker", intended for firing the release solenoid on cash drawers. I'm sure someone can find a use for that.

(I spent some time in the POS software mines)

> The home equivalent of a fast food kitchen ticket printer!

Exactly where my head went haha, next thought was having a clip to hold the recipe up :p

A regular printer, a binder, and a three-hole punch work fine. As a bonus, the printer is also useful in other ways, and any mementos produced with it will last in a way thermal paper never really does.
Yes, it does, and we have one for some recipes. It’s bulkier than these would be, and we don’t have a lot of counter space. Also doesn’t solve the disposable problem. We have plastic sheets to protect the pages which works good enough, and it’s easy to print new pages if some get soiled anyway.

I don’t want mementos, I want disposable references.

It’s also not that big of a deal if this isn’t feasible, because the binder works fine, the phone works fine. This is just sparked a “hey, what if…” idea is all.

Once it's out of alpha you can self-host this project
It sounded to me like once it’s out of alpha the pricing model is “TBD, but likely pay-per-print”.
I really like the proposal from black_puppydog here. Free forever self-host and a pay-per-print in case you want to have support or don't want to hassle with the infrastructure. Like Coolify is doing it.
Sounds fine to me! I’d also be happy with a reasonable one-time payment for the self-hosted version.