SingleFile icon indicating copy to clipboard operation
SingleFile copied to clipboard

Option "save print version"

Open mabra opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe.

On larger webseites which publish articles, these pages usually contain ads, navigation and so on and they provide in many cases alternative CSS for the case you print the page. If you then decide to print - "print to pdf" - navigation and ads are omitted in output. Most of the time, exactly what you wish.

Describe the solution you'd like

Another save option, say "save print-version", which switches - somehow - to the version described above and then save the page would make it really perfect!

Describe alternatives you've considered (optional)

Saving as PDF, but this is in many cases (I can only talk about firefox) very ugly, image are overlayed by headers and such effect and sometime some content is not in the output. A worst case in saving a webpage.

Additional context (optional)

mabra avatar Sep 15 '24 19:09 mabra

Thank you for the suggestion! I agree it's an interesting feature, I think I could add an option to keep only the stylesheets associated to the print media. It won't be perfect though because it often doesn't exist. In such a case, the native “print to pdf” feature takes care of formatting the page on its own as far as I know.

gildas-lormeau avatar Sep 16 '24 21:09 gildas-lormeau

And we can use Stylus or JS to mod the page further.
It would be even better to have a custom media type, but this is not very possible.
Using non-standard media type will void the whole query part e.g. @media singlefile There are few obsolete descriptors,
but their description don't fit the purpose, and they are obsolete. The same with Media Features. I can only see some hackish possibility: e.g. @media (height: 9999999px), which would not fail in browsers and would quite-never be true, but that's horrific.

If you are not parsing the media queries already, the logic of logical operators and brackets could be tricky,
the easy - lazy way of implementing this print media feature might be to replace all print types on a page with all, all screen with not all. This does not fail in browsers and the saved page could also be printed.

Parts of media query containing screen could probably be removed. I was considering a case like: @media screen or (min-width: 10px) {}, but this seems to not be valid. I did not find an explicit statement saying or can only be used between media features and not media types, but firefox would change such query to @media not all, screen { and chrome would ignore it and pass its content.

paponius avatar Apr 21 '25 13:04 paponius