\

How to build a printer

328 points - yesterday at 9:22 PM

Source
  • ValdikSS

    today at 1:21 AM

    >penguin would shrink the result to fit its screen. >I declared A5 and Letter paper, media type stationery, and an output bin called face-up.

    You can (and should!) define exact dimensions of your screen in `media-size-supported`. It will probably be a non-standard IPP name, that's why you should define that in `media-supported` as `om_NNNmmxYYYmm` or `oe_NNNinxYYYin`

    That way you don't need to scale the incoming data, the PC will format it exactly to the dimensions of the screen.

    Both PWG Raster and Apple Raster support 1-bit-per-pixel mode (instead of 8-bit-per-pixel you use), that's why the input could be 8 times less in size. Use `print-color-mode-{supported,default}=bi-level` instead of `monochrome` for that. And also tune `urf-supported`'s `W` option, use `W1` for this case.

    The screen/dithering could be ass in 1-bit mode, see https://github.com/OpenPrinting/libcupsfilters/pull/160 where I added more dithering options (Linux-only though, Apple seems to abandon their CUPS).

      • Neywiny

        today at 1:53 AM

        This is why I like it here. Somebody does irrefutably incredible work outside of their comfort zone, and somebody else goes "yeah actually I was born in that zone. Moulded by it. Here's how to improve it" (in a positive way)

          • ValdikSS

            today at 2:15 AM

            Oh no, I wasn't, and that's definitely not my comfort zone. I mess with the printers and printing stack due to anger, not because I like it.

            It's bugs on bugs, with bugs chasing bugs! So little developers, so complex stack with 25 years of technical debt, and little community around because it's not a sexy technology to be involved in.

            That's why I have to dive deep and fix my bugs myself if I want to make it work properly as I would like it to. I also ended up making my own print server device, because China did not make a proper one for some reason for all these years.

              • lopis

                today at 6:15 AM

                Anger is the only valid emotion when dealing with printers.

                • edoceo

                  today at 4:14 AM

                  That's even cooler

                    • quijoteuniv

                      today at 6:33 AM

                      Same feeling when family or friends ask me for help with Micros word about formatting, tables or inserting pictures in the last 25 years….

          • darkvision77

            today at 7:47 AM

            > Use `print-color-mode-{supported,default}=bi-level` instead of `monochrome` for that

            The last time I checked (a year ago), 1bpp was suddenly supported only by Windows. IIRC, monochrome is REQUIRED, while bi-level is OPTIONAL in RFC.

            Not sure how things stand now, though. Ever since then, I've just been carrying Floyd–Steinberg dithering around.

            • cat-whisperer

              today at 1:48 AM

              lovely, this would save me a bunch of memory during transformation and dithering. Will do!

          • alternativeworl

            today at 1:57 AM

            Very cool. I was expecting to learn about the ins and outs of ink, printheads etc but instead learned "How to build a paper that acts like a printer" which turned out much more entertaining.

              • cat-whisperer

                today at 2:15 AM

                glad you liked it!

            • tapia

              today at 5:20 AM

              In Linux it's pretty easy to create such things with cups. A while ago I did a cups backend for my Fujitsu Quaderno A4 [1]. It is super useful to be able to just open any document, in any program that supports printing, and then just "print" it to my device.

              [1] https://github.com/cristobaltapia/dpt-rp1-cups

                • IdiotSavage

                  today at 5:49 AM

                  > any program that supports printing

                  Unfortunately printing support seems to go out of fashion, at least in macOS land.

                  Lately I needed a quick printout of a markdown document. I could have used TextEdit for the raw text, but I wanted the styling too. Learned that neither VSCode, Xcode nor Obsidian can print. (There is a community plugin for Obsidian.)

                    • rrr_oh_man

                      today at 6:29 AM

                      LOL. TIL you can’t print from VSCode.

                        • maybewhenthesun

                          today at 7:40 AM

                          printing has never really been a thing from text editors I think.

                          Used to be that printing a text file was just `cat myfile.txt > /dev/lp0` .

                          It has been a while since I printed a plain text file, but I guess there's still a similar command available with some research.

                            • voidUpdate

                              today at 8:53 AM

                              I've done the same from a raspberry pi to a receipt printer, just piping to lp0

                          • simonjgreen

                            today at 6:45 AM

                            Or Obsidian

                • kitd

                  today at 7:19 AM

                  Good article.

                  One of the great things about having an open platform like the Xteink is that it should uncover loads of novel and unsatisfied use cases. Eg, this could be paired with a mobile phone to act as a secondary display much better suited to outdoor applications in bright sunlight.

                  • pimterry

                    today at 8:21 AM

                    This would be a neat API for a digital photo frame - just print photos to it and they appear on the screen.

                      • cat-whisperer

                        today at 8:33 AM

                        yes!!

                    • ks2048

                      today at 12:29 AM

                      Good job, but I’m left wanting to know how to build a printer.

                        • tdeck

                          today at 3:18 AM

                          If a DIY plotter would do, this site has a long list of different projects

                          https://mattwidmann.net/notes/pen-plotters/

                            • voxelghost

                              today at 6:12 AM

                              What if I want a cabinet sized rotating head printer that can print carbonpaper triplets, sounds a machinegun, and has LP0 ON FIRE error message

                                • today at 6:31 AM

                          • cat-whisperer

                            today at 12:40 AM

                            I'd say it's an eco-friendly printer

                            • d--b

                              today at 4:56 AM

                              There is an open source one https://www.opentools.studio

                                • zxexz

                                  today at 7:08 AM

                                  How is that open source? There’s not a single line of code. No CAD. Nothing. Sure, there’s a “coming soon” CrowdSupply link, which I guess is more than a KickStarter. But open source?

                                    • d--b

                                      today at 8:46 AM

                                      Ah sorry, I thought they were already open source. They say they will open source it once they finalize the design, but yeah, not there yet.

                          • yeasin-arafat

                            today at 8:02 AM

                            Emulating a network printer to send pages to an e-ink screen is such a clever hack. Every OS already has the print dialog built in.

                            • e12e

                              today at 5:06 AM

                              Nice. I keep wondering if these devices would play nicer with DjVu rather than pdfs and raster formats?

                              https://djvu.sourceforge.net/

                              • jiehong

                                today at 6:06 AM

                                Pretty cool work! And it’s nice to see printer discovery works through the standard mDNS!

                                Regarding the size of the page being sent to the printer, I remember reading that printers used to be postscript interpreters and the result of that program would be the page.

                                Perhaps that would trade ram for compute, but might be more complex in the end.

                                • Wilson2000

                                  today at 9:19 AM

                                  Love this!

                                  • jarboot

                                    yesterday at 11:24 PM

                                    This is amazing!!! It just makes sense. And its just how you would want to use a e reader.

                                      • cat-whisperer

                                        yesterday at 11:31 PM

                                        if it looks like a paper, it should act like a paper

                                          • nomel

                                            yesterday at 11:45 PM

                                            You can even fold it, once!

                                              • cat-whisperer

                                                today at 12:16 AM

                                                It's also not effective against rock

                                                  • valleyer

                                                    today at 12:19 AM

                                                    Funny. But... paper covers rock.

                                                      • sudo_cowsay

                                                        today at 12:49 AM

                                                        Jan Ken Po!

                                    • greazy

                                      today at 12:36 AM

                                      I don't understand the purpose. What am I missing?

                                      The author "prints" to the eink display. Why not load say the pdf directly?

                                        • sowbug

                                          today at 4:48 AM

                                          I've wanted something like this for a long time to print recipes that I'm about to cook. I don't want my phone in the kitchen getting gunk on it, so I'll usually print on paper, get the gunk on the paper, and then throw it out.

                                          I'm not going to create a recipe PDF and load it on an e-reader. That's too much work. But I will happily press control-P on a recipe web page and select the eink display as the target.

                                            • greazy

                                              today at 8:53 AM

                                              Right! I like this usecase very much. For uses existing software infra to perform the required task.

                                              I wonder now what else we've reinvented when it comes to sending data...

                                              • cat-whisperer

                                                today at 5:01 AM

                                                I am no cook, but you my friend are cooking something here

                                            • stdatomic

                                              today at 12:44 AM

                                              From the 4th line in the article:

                                              > But getting stuff onto it was tedious. I had to join its hotspot and open a little upload website in my browser. Yuck.

                                              Anyway, very creative, I like the idea a lot.

                                              • maybewhenthesun

                                                today at 7:44 AM

                                                I'd like my e-reader to show up as a printer, and when I print something on it it actually gets saved as a pdf on the reader. Like in the article, but multi-page pdf.

                                                I often do 'print to A5 pdf => copy pdf to e-reader'. Would be nice to do that in one step from any program that can print.

                                                • cat-whisperer

                                                  today at 12:38 AM

                                                  > I was thinking of this, but rendering PDF takes a lot out of a 400KB RAM'd device. It also needs a ton of things to actually work which the ROM can't hold.

                                                  > Kindles have a ton of RAM, this one didn't.

                                                    • ghostly_s

                                                      today at 1:53 AM

                                                      It's an e-reader. According to the specs it has native support for PDF.

                                                        • mrheosuper

                                                          today at 2:10 AM

                                                          It's an esp32 MCU, even if it can somehow run the PDF render pipeline, it won't be more ideal than just accept the raw byte stream and display.

                                              • joshmarinacci

                                                today at 12:23 AM

                                                I love the concept, but I wonder why he wasn’t printing to PDF. Can this device not render PDFs?

                                                  • ValdikSS

                                                    today at 1:39 AM

                                                    PDF is very, very complicated standard which can't be handled properly on tiny MCUs with reasonable performance and spec conformance:

                                                        - 4 font formats
                                                        - 9 image formats
                                                        - blending with transparency
                                                        - different colorspaces, each image could use its own on the page
                                                        - different dithering algorithms, each image with its own
                                                        - the page can have elements from another pages (global elements)
                                                    
                                                    This is only a small part from the top of my head.

                                                    Common simple home printers absolutely should not accept regular PDF as an input: thanks to Apple and IETF we now have Apple Raster and PWG Raster for printers, as a part of AirPrint and IPP Everywhere/Mopria driverless printing standards, which are very similar but have slightly different options and headers. It's a simple raster input for printers specifically.

                                                    Some companies, such as HP, invented a "raster PDF": PCLm / PCLms. Don't be confused by the name, it's a regular standard-conforming PDF which contain nothing but a full-page JPEG on each page, and don't use any other features. It's created only to be able to open "printed page" (driver output) in a standard PDF viewer on a PC for debugging or business logging needs, but otherwise it's like a regular JPEG with additional per-page metadata.

                                                  • cat-whisperer

                                                    today at 12:29 AM

                                                    I was thinking of this, but rendering PDF takes a lot out of a 400KB RAM'd device. It also needs a ton of things to actually work which the ROM can't hold.

                                                    Kindles have a ton of RAM, this one didn't.

                                                    • bluGill

                                                      today at 12:29 AM

                                                      Probably not. It doesn't appear to have enough ram. I'm not sure the CPU is up to that either.

                                                  • stavros

                                                    yesterday at 11:41 PM

                                                    I've been seeing the Xteink a lot lately. Should I get an X3 or an X4? I don't really know why I want it, but I have an eInk addiction, so I just need it.

                                                      • a2dam

                                                        yesterday at 11:52 PM

                                                        I've owned all of them and the answer is the X4 Pro IMO. It has a backlight, which is the only thing I really missed on the others.

                                                        • cat-whisperer

                                                          yesterday at 11:45 PM

                                                          It's funny that X3 is a successor of X4. Only downside is that X4 has a USB-C port and X3 doesn't

                                                            • stavros

                                                              today at 12:11 AM

                                                              What about the back light? Are they otherwise identical?

                                                                • cat-whisperer

                                                                  today at 12:22 AM

                                                                  X3 isn't backlit, but the battery lasts 7 days. So, it's pretty good for me

                                                          • hamaluik

                                                            today at 1:05 AM

                                                            I bought an x4 a month or so ago, zero regrets. It sounds hyperbolic but it’s finally been the thing to actually decouple me from my phone. Whenever I’m out and about, bored, I just slide it out and pick up where I left off reading last. It’s a nicer reading experience on my kobo but the portability and.. frankly charm just can’t be beat.

                                                        • sho_hn

                                                          today at 12:00 AM

                                                          This is a fantastic idea!

                                                          • NDlurker

                                                            today at 12:44 AM

                                                            Very cool. I'll be updating to this fork

                                                              • cat-whisperer

                                                                today at 12:51 AM

                                                                Thanks. It's rough around the edges, so PRs are open, and there's a recipe in the repo if you want to build your own apps.

                                                            • andyfilms1

                                                              yesterday at 11:20 PM

                                                              We finally have PADDs from Star Trek!

                                                                • cat-whisperer

                                                                  yesterday at 11:33 PM

                                                                  Wow!! I didn't think of that.

                                                              • Brian_K_White

                                                                yesterday at 10:42 PM

                                                                Outstanding! This is so...correct.

                                                                • phoenixtao

                                                                  today at 3:32 AM

                                                                  [dead]