Live data from Hacker News

CSS for printing to paper

voussoir.net

51–60 of 139 posts

Re: CSS for printing to paper

#51

Browser support for printing is so bad that I'm going to have to create a native app for https://www.thingybase.com to have a streamlined workflow of printing labels to a thermal label printer. It works now, but first you have to download a PDF and print that. Google Docs does this too when you hit "Print". I've tried hacks like load the PDF in an iframe and use some JavaScript to print that, but then I get footers w…

You can force remove the URL and page numbers on the printout by setting the @page rule padding to 0

Re: CSS for printing to paper

#52
post #49

Earlier quoted context omitted.

> A native driver is definitely the way to go with these. Not if you need to support a bunch of different printers. For me PDF is the way to go, but browsers can't print a PDF via a "Print" button within the HTML, so instead I have to build apps that download the PDF and print it directly through operating system APIs.

I have this in my SaaS, as well. I built an Electron app that ushers the jobs from the cloud to the thermal printer. It all works until there is a failed job and the queue backs up. I haven't quite figured out how to monitor the queue remotely yet.

I’m probably going to run the app inside of Electron and print from there, so it will be easier in my case for the users to monitor the queue.

Re: CSS for printing to paper

#53
post #2

I would love to see some svg thrown into this. Let's kill pdf!

I’ve never understood what everyone’s issue with PDF is.

It’s like digital, printed paper. Part of the reason is pretty much ubiquitous compatibility.

If it needs to be edited, just don’t print it on digital paper. Does the format have other issues?

Re: CSS for printing to paper

#54

I just laid out a book using Pagedjs.org. Although there were a few bugs in the preview experience, the final output was perfect, and probably took me a quarter the time it would have in InDesign (which I’m fairly competent in). The real power is in being able to hook up all the templating, CMS APIs, and whatever else you want into your content pipeline. It’s Just HyperText™. I’d go so far to say that if you’re equal…

I wonder how the finer issues of typesetting are handled with print CSS compared to dedicated typesetting software nowadays. CSS is very compelling, but then based on my personal experience as print media designer the likes of InDesign are full of various special tricks (and language-specific, too) for alleviating white space corridors, handling hanging punctuation, hyphenation, etc. that the enterprise-level softwar…

It is limited and depends on the browser used to print the document. The most glaring missing feature is CMYK colour.

I’ve just set up our publications to use PagedJS, and with a fair amount of hacking I was able to set up a baseline grid. Hyphenation depends on the browser implementation, which is OK for English in recent Chromium. The new text-wrap property has also been helpful. Hanging punctuation is only supported in Safari if I remember correctly.

But being able to produce nice looking PDFs from a markdown document, with automated endnotes and table of contents, is a much nicer process than going through InDesign, and I also say this as someone equally comfortable with both. And the result is good enough for our purposes.

Here is an example: https://www.lowyinstitute.org/sites/default/files/2024-03/LA...

Re: CSS for printing to paper

#55

I just laid out a book using Pagedjs.org. Although there were a few bugs in the preview experience, the final output was perfect, and probably took me a quarter the time it would have in InDesign (which I’m fairly competent in). The real power is in being able to hook up all the templating, CMS APIs, and whatever else you want into your content pipeline. It’s Just HyperText™. I’d go so far to say that if you’re equal…

Cool! This was one of the tools I considered to help get the open-access textbook to its print version (to be published later in 2024). Since I was using Hugo I went with some custom CSS that gets enabled during the PDF build phase and website2pdf to handle the generation: https://github.com/jgazeau/website2pdf

Open-access textbook: https://www.utilitarianism.net/

Open source: https://github.com/whyboris/utilitarianism.net

Re: CSS for printing to paper

#56
I've always (like in over a decade) knew CSS as by far the easiest way to print from any app I would build. Just output some concise HTML+CSS and a reasonably pretty printable document is ready. Perhaps learning PostScript or TeX could give me more but I found these prohibitively hard as long as I want to print something custom and not the template everyone uses. Meanwhile writing printer-optimized CSS typesetting just took me some minutes although I never had to dedicate any time to study it seriously (some w3schools was enough).

Re: CSS for printing to paper

#59

I just laid out a book using Pagedjs.org. Although there were a few bugs in the preview experience, the final output was perfect, and probably took me a quarter the time it would have in InDesign (which I’m fairly competent in). The real power is in being able to hook up all the templating, CMS APIs, and whatever else you want into your content pipeline. It’s Just HyperText™. I’d go so far to say that if you’re equal…

I wonder how the finer issues of typesetting are handled with print CSS compared to dedicated typesetting software nowadays. CSS is very compelling, but then based on my personal experience as print media designer the likes of InDesign are full of various special tricks (and language-specific, too) for alleviating white space corridors, handling hanging punctuation, hyphenation, etc. that the enterprise-level softwar…

The lack of manual kerning to avoid rivers of white space is something that I wouldn't even begin to know how to tackle in CSS. Maybe I'm just too muscle memory familiar with the tools in DTP vs CSS for Web, that I'm just not familiar with the proper CSS for it. The wysiwyg of DTP apps is like pure training wheels or a warm fuzzy blanket in getting work done
Post reply on HN