Live data from Hacker News

CSS for printing to paper

voussoir.net

121–130 of 139 posts

Re: CSS for printing to paper

#121

Browser support for printing CSS is spotty. Worse: some features, like footnotes on every page, don't have any equivalent in CSS I know of. Is there any easy to use/hack HTML layouting engine where I could experiment with custom CSS attributes and bridge that gap? Would anything from Servo be suitable? Modifying an entire browser with its bloat is too much effort. There is no JS or cookies on paper (they can be in pa…

https://pagedjs.org has a polyfill that implements https://www.w3.org/TR/css-gcpm-3/#footnotes

I wish HN supported footnotes and citations in comments. It would be pretty cool.

Re: CSS for printing to paper

#122

Earlier quoted context omitted.

> Brother's website for finding the mac drivers is a bit of a maze of misdirection that tries to get you to install their extremely shitty application. That seems surprising, considering how no-muss no-fuss their hardware & cartridges are. (As compared to, say, H-P.)

I think it's just regular incompetence for hardware companies not really being on top of their software game.

They should just publish technical information and let the Linux community make the software for them. All hardware companies should work like this. The results will be much better than their shitty "cost center" approach to software.

Re: CSS for printing to paper

#123

Earlier quoted context omitted.

And it's not just a Paged.js thing. No "hacks" necessary. https://www.w3.org/TR/css-page-3/#page-based-counters

paged.js is a polyfill that implements this. I'm not aware of any browser that support this. Why do you call paged.js a "hack"?

My quoted "hacks" was in response to the parent "impossible with css hacks".

I'm a big fan of paged.js.

Re: CSS for printing to paper

#124

Earlier quoted context omitted.

And it's not just a Paged.js thing. No "hacks" necessary. https://www.w3.org/TR/css-page-3/#page-based-counters

What browser does it work in natively? I tried this a couple of years ago and a few people claimed that it worked in kiosk mode for Chrome but I couldn't get it to work in any browser.

It looks like it should be available in all major browsers.

https://developer.mozilla.org/en-US/docs/Web/CSS/@page#brows...

That said, I've always used paged.js with its polyfills to fill in other gaps. So maybe there's something I'm unaware of.

Re: CSS for printing to paper

#125
post #48

Earlier quoted context omitted.

Weasy is tight . Unfortunately, my org banned Python across the board, else that would have been my choice.

I feel like there's a story here.

Nothing all that exciting, I'm afraid. The new director of InfoSec must have watched a Cable News Show about supply chain attacks, or something, so suddenly anything with package management - pip, npm, gem, etc - was banned from the official Windows policy. Since his flunkies didn't want to get nailed, they just went ahead and flushed any associated environments/runtimes too. It wasn't super consistent. It was, however, generally a surprise - you'd log in one Monday and whoops! Where'd my Python tooling go?

Now, ok, funny thing. Engineering could just get bare metal laptops, whenever they wanted, then blow the thrice-blessed CentOS image on it, and then do whatever the hell. So what happened - and this probably sounds real predictable - they used the CentOS machines to make all sorts of nutty crap, boxed it up, and then sent it back to their "official" Windows machines, now as a locked-in-amber config that never updates, even if five years later it had like fifty zero days in it and none of the libraries were good anymore.

I understand it took a new director and a LOT of meetings to explain whitelist mirrors for package managers, but I was long gone by then, even if I had a tiny hand in rolling out the demo whitelist mirror on-prem. Man, I had no idea what I was doing . . it still makes me shudder when I think of the things they were asking me to do.

Re: CSS for printing to paper

#126

The code seems very opinionated, at least it is pretty focused on US needs. I don’t want someone to tell me what paper I should use (size: Letter portrait). Frankly I don’t own letter-sized paper. Also all sizes are in inches, which I don’t calculate in and wouldn’t know whether still sensible margins when printing on a different paper size.

I have been making these generators for my workplace, so the project scope is very narrow. You can follow the idea with any dimensions you need.

If you want to use these techniques on a global site, I think you could use multiple @page styles and switch between them with a dropdown like I did with portrait/landscape. Although A4 and letter are very close in size.

Re: CSS for printing to paper

#127

I recently setup a label printer where the labels get printed from a full page app to a Brother label printer that takes rolls of 62mm wide and 30 meters long. The printer cuts after each page break. It's a regular usb printer but with a funny page size. Also, Brother's website for finding the mac drivers is a bit of a maze of misdirection that tries to get you to install their extremely shitty application. In the en…

> - Firefox has no print preview. This makes testing a bit hard. I used Chrome for testing this in the end.

File -> Print (ctrl+p), the preview takes up the majority of the dialog.

Re: CSS for printing to paper

#129
post #72

A few of my favorite print styles, from my personal site: h2,h3,h4,h5,h6,h7,h8 {break-after: avoid-page;} img, svg, table, canvas {break-inside: avoid;} a::after {content: " (" attr(href) ")";} Explanation: - Avoid printing section headers at the bottom of one page with the section content left headerless at the top of the next page. - Prefer printing graphics and figures on whole pages instead of split across pages.…

Sounds like all of these should be the default for print-like output devices.

Re: CSS for printing to paper

#130

Browser support for printing CSS is spotty. Worse: some features, like footnotes on every page, don't have any equivalent in CSS I know of. Is there any easy to use/hack HTML layouting engine where I could experiment with custom CSS attributes and bridge that gap? Would anything from Servo be suitable? Modifying an entire browser with its bloat is too much effort. There is no JS or cookies on paper (they can be in pa…

> Is there any easy to use/hack HTML layouting engine where I could experiment with custom CSS attributes and bridge that gap? Would anything from Servo be suitable? Servo could be used for this. You'd want to add support for parsing the CSS properties themselves to the style crate in https://github.com/servo/stylo and then the layout implementation to the layout2020 crate in https://github.com/servo/servo . You do e…

How does it compare with https://github.com/litehtml/litehtml?
Post reply on HN