news.volyx.in

CSS for printing to paper (voussoir.net)

615 points by Tomte · 897 days ago · 137 comments on HN

Article summary

The article discusses the basics of CSS for printing to paper, including the use of the @page rule, media queries, and element positioning. It also covers techniques for handling multi-page documents, portrait and landscape modes, and data sources. The author shares their experience with generating print-friendly HTML pages and provides a cheatsheet of CSS rules used. The article aims to help developers create print-friendly web pages that mimic traditional printed forms.

Main themes

  • CSS for printing
  • Print-friendly web pages
  • Multi-page documents
  • Portrait and landscape modes
  • Data sources
  • HTML layout engines

What commenters say

  • Some commenters suggest using alternative formats like SVG or EPUB for printing, while others argue that PDF is still a viable option due to its ubiquity and compatibility.
  • There is a need for better support for printing CSS in browsers, with some features like footnotes and citations currently lacking or inconsistent across browsers.
  • Some developers have had success using libraries like PagedJS and Weasyprint for generating print-friendly PDFs, while others have encountered issues with browser-based printing.
  • The use of CSS for print layout is limited compared to dedicated typesetting software like InDesign, particularly when it comes to fine-tuning typography and layout.
  • Some commenters argue that the benefits of using CSS for print layout, such as ease of use and flexibility, outweigh the limitations, while others prefer the control and precision offered by dedicated design software.
  • The choice of tool for print layout depends on the specific needs and goals of the project, with some preferring the convenience of browser-based printing and others opting for more specialized software.