Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

feature request: anti-widow option to eliminate page breaks #3404

Open
ghost opened this issue Mar 23, 2017 · 4 comments
Open

feature request: anti-widow option to eliminate page breaks #3404

ghost opened this issue Mar 23, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 23, 2017

It's often useful to print a webpage on exactly 1 page. The problem is wkhtmltopdf needlessly forces users to choose an absolute boundary for page breaks (a4, a5, etc).

The workaround: I use a for loop to cycle through all the page sizes, running wkhtmltopdf for each one of them, then run pdfinfo on every PDF produced to find the files with only 1 page. The side-effect with this brute-force workaround is that some whitespace still appears.

What's needed: users need to be able to specify aspect ratio only, and no page breaks. Then wkhtmltopdf should choose the smallest custom height and width that respects the aspect ratio and gets everything on one page. The user can then print the PDF using their preferred paper size and the "shrink to fit" option.

This feature should be trivial implement, because if I understand correctly, wkhtmltopdf already renders the webpage as a single page internally, as an initial step. It just needs to skip the page breaking.

@PhilterPaper
Copy link

Is #1627 the same thing that you're asking for?

Remember that PDF was architected to map text content to printable standard-sized paper media, so display-only arbitrary media dimensions (that can never be printed) are a bit of an abomination.

@ghost
Copy link
Author

ghost commented May 24, 2017

Is #1627 the same thing that you're asking for?

yes, in effect. Although 1627 neglects to mention aspect ratio.

Remember that PDF was architected to map text content to printable standard-sized paper media,

Great ideas often evolve into much more than originally planned. PDF happens to be the format of choice for presenters who want to create a slide show (using LaTeX) without being trapped in MS Powerpoint. We need not limit ourselves to the original intent.

so display-only arbitrary media dimensions (that can never be printed) are a bit of an abomination.

For me, the 1-page PDF is in fact precisely to facilitate printing. The PDF dimensions need not match the media. I'll often capture a webpage on a single ledger-sized area, and then use the shrink-to-fit feature to scale the content to the output page.

@PhilterPaper
Copy link

An interesting concept (to use PDF instead of PP and the like). Does LaTeX still offer a "slides" package? If you're looking to project pages as slides (whether a TV projector or Kodachromes or foils/fiche), you're under constraints as to aspect ratio and minimum font size, so I don't see any advantage to trial-and-error finding a media size that outputs to just one page. I think you would be better off fixing your font size and aspect ratio (and from that, your page size), and putting your effort into rewriting to adjust and group content into pages (assuming you have control over that). However, to each his own...

As for formatting to a ledger page and shrinking it down, if you and your audience don't mind wildly differing character sizes, that could work. Personally, it would drive me crazy. If the text origin is something you have no control over, and you need to show the whole thing, it's OK to slightly reduce a standard font size to get it to fit on a minimum number of pages, but I would advise not going overboard to get it to fit on a single page. If your management is that anal about it, you've got bigger problems.

@ghost
Copy link
Author

ghost commented Jun 2, 2017

Does LaTeX still offer a "slides" package?

Yes, it's called the "beamer" class. I use it.

If you're looking to project pages as slides (whether a TV projector or Kodachromes or foils/fiche), you're under constraints as to aspect ratio and minimum font size, so I don't see any advantage to trial-and-error finding a media size that outputs to just one page.

You've overloaded the rationale for the LaTeX slides discussion. It has nothing to do with the feature request at hand, it was merely an example of how we need not be constrained to the original (hardcopy) intent of PDF design. Indeed products of the LaTeX beamer class are controlled by the author and need no special page break features that would be applied to the PDF.

it's OK to slightly reduce a standard font size to get it to fit on a minimum number of pages, but I would advise not going overboard to get it to fit on a single page.

Of course there is a threshold of tolerance. The most common scenario is wkhtmltopdf produces a "widow". That is, a document is one page plus a sentence (or fraction thereof) that spills over to page 2. Or just a footer spills over. This is very annoyingly common with HTML documents. Then we have a page 2 that is mostly blank. It's even more ridiculous if it's then printed using a simplex printer that wastes another sheet of paper just for the widow.

This feature request herein is to remedy widows, not generally to compress 3 pages of content into 1. (I've just updated the subject to reflect this). OTOH, if a user would want to abuse the feature and cram copious content on one page, it is them who should be the judge for whether it's a good idea.

@ghost ghost changed the title feature request: option to eliminate page breaks feature request: anti-widow option to eliminate page breaks Jun 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants