Indeed. During my troubleshooting, I did run across a bunch of print layout 
engines using CSS as the input and PDF as the output but I wanted it to be 
strictly browser-based. I have tested in with Chrome and Firefox on Linux 
and Chrome on Windows (the target for my original use-case) but am 
interested in how it works with other people's browser/OS configurations.

Some of the issues that I ran into:
1) All the little margins and padding that get placed everywhere even 
though you have not specified anything and it is just an "unprintable" and 
"undisplayed" whitespace in the html drove me nuts. It isn't. Mostly solved 
by setting font size and line heights to zero on the containing elements 
and then resetting them to the size you want where you want them. Sometimes 
solved in a case by case basis by html commenting out whitespace. It 
weirdly works.

2) Also, there is a little bit of margin around the html body element that 
causes a weird margin at the top (screwing up your pagination on the first 
page only) and at the end (giving you an random extra page on templates 
that fill up the top to bottom space like tent cards). I had to force that 
to zero in the @media print rule.

3) @page rule is a wonderful concept for printing that is largely ignored 
in Chrome. Chrome depends on manual print page margin setting which makes 
it great for over-riding crappy print layouts but makes it impossible to 
make things completely automatic. I got to the point where only the top 
margin setting is needed and the rest should be zero. If you set all the 
manual margins to zero in Firefox, the @page top margin is respected and 
things line up automatically. I wanted to fake this using and n-up layout 
within TiddlyWiki but could not figure out how or if it can process n list 
items at a time.

4) I would have liked to have some automatic resizing/scaling of fonts to 
fit each unit div but apparently that does not exist unless you hack it up 
by iterating with javascript which is beyond my skill-set. My first attempt 
as squeezing text in was to use the "condensed" version of a font but 
whether the font that a browser chooses has a condensed variant is hit or 
miss even with the same font-family specification. I ended up just 
squeezing by changing the font size on the line that was assumed the 
biggest but what is done with that checkmark is template specific. This 
might turn into a slider or a +/- button in the future to allow some fine 
tuning.

Anyways, thanks for checking it out.

/Mike

On Saturday, March 17, 2018 at 5:28:06 AM UTC-4, @TiddlyTweeter wrote:
>
> The Label tool got my interest in that its trying to deal with the 
> somewhat complicated problem of getting printers to behave using CSS. This 
> is important if you need to strictly control print layouts.
>
> I'm not sure its entirely successful as a generalisable approach. But its 
> a hell of a lot better and illustrative than most anything I have seen in 
> TW so far. Must have been a lot of work?
>
> FYI, a useful resource on learning about and addressing print issues from 
> HTML pages in a CSS driven way is the PRINCE system 
> https://www.princexml.com/. Prince aims to bring to utilisation of CSS 
> for document printing exact, cross-browser repeatable layout.
>
> Best wishes
> Josiah
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/031ca6f1-ea5a-489a-9e2c-cf663d68d40f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to