Live data from Hacker News

CSS for printing to paper

voussoir.net

11–20 of 139 posts

Re: CSS for printing to paper

#11
I can't help but feel like this is going full circle.

CSS started with print media in mind since this was what was available at the time.

Many of these features have been there since the inception. Just that browser support has been lagging.

How do you break a table inside a float? Etc.

Re: CSS for printing to paper

#12

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…

Css has support for footnotes, but it's not yet supported by chrome

Re: CSS for printing to paper

#15
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 with the URL of the webpage, which doesn't work for my purposes.

If you work on Chrome/Blink, Safari/Webkit, or Firefox/Mozilla please please please at least get the hacks working!

A CSS standard would be great, but really I'd be happy if I could call a function like `windows.print("/document.pdf")` and have it print the PDF without all the footer/headers stuff.

Re: CSS for printing to paper

#16

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…

I’ve worked with thermal printers and they are actually quite capable. They have drawing primitives that allow you to lay out basic graphics and the one I was working with even had basic font support. A native driver is definitely the way to go with these.

Re: CSS for printing to paper

#17

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…

I’ve worked with thermal printers and they are actually quite capable. They have drawing primitives that allow you to lay out basic graphics and the one I was working with even had basic font support. A native driver is definitely the way to go with these.

> 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.

Re: CSS for printing to paper

#18
post #12

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…

Css has support for footnotes, but it's not yet supported by chrome

Can you give some more information? Is it supported by Firefox or Safari? I found https://www.w3.org/TR/css-gcpm-3/#footnotes but it seems to be completely unsupported at this time.

Re: CSS for printing to paper

#19

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 effectively get a whole browser though.

I'm currently working on building a lighter weight / hackable layout engine based on a combination of https://github.com/servo/stylo (for css parsing and selector resolution), https://github.com/DioxusLabs/taffy (for box-level layout) and https://github.com/pop-os/cosmic-text (for flow/inline layout). I expect to have something decent in around 6 months

Neither of these setups currently have any support for pagination though.

Re: CSS for printing to paper

#20

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…

Well, you can use .pdfp to print it on Windows.

You will need adobe acrobat (free). This is a very old trick but still works on Windows 10. We use it with the latest edge.

I do wish that the browser had a special direct printing option.

https://groups.google.com/g/comp.text.pdf/c/dHuBMsaovco?pli=...

Post reply on HN