Re: [csswg-drafts] [css-page-3] Specify how to handle page sizes with zero area (#8335)

Yeah, infinite-loop-avoidance isn't my concern here. I agree that it's ~fine to just make a little forward progress on each page, shrug about content being clipped if necessary (e.g. a 16px-tall character on a 0.1px height page), and move on.

The open questions that motivated this, at least for `size:0`, were: 
* If a browser were to faithfully honor `size:0`, how would print-preview even work for that "page"?  Browsers typically scale the 'virtual sheet of paper' to fit the print-preview viewport, so even extremely small sheets of paper can be usefully previewed.  But you can't scale a 0-sized sheet of paper.  So the user will just see: `Here's your print preview: [nothingness], page 1 of 60`, which is not-great and arguably pretty broken.

* Even if we disregard that UX concern -- suppose the user actually proceed to print to PDF or to postscript.  Does a valid file get produced, and can that file be usefully viewed in any viewer? i.e. is it even valid a .ps or .pdf file with zero width and/or height? (I'm actually legitimately not sure, but I suspect it'd be bogus.)  I tested a little bit with `gs` (ghostscript) locally and got an error when I tried to render some trivial existing PDF (`orig.pdf`) onto a zero-size page:
```
gs -sDEVICE=pdfwrite -g0x0 -dPDFFitPage -o out.pdf orig.pdf
gs -sDEVICE=pdfwrite -g1x0 -dPDFFitPage -o out.pdf orig.pdf
gs -sDEVICE=pdfwrite -g0x1 -dPDFFitPage -o out.pdf orig.pdf
```
All of these^ command variants produce `Unrecoverable error: rangecheck in .putdeviceprops`.
If I use `1x1` as the size in that command, though, then it completes just fine and produces a valid PDF.

-- 
GitHub Notification of comment by dholbert
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8335#issuecomment-1399035914 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 20 January 2023 22:39:16 UTC