127

UPDATE:

Version 1.1 - MySE section, PrettyPrint, StackPrinter API

Screenshots:

App Homepage

Homepage screenshot

Printable view

Printable view screenshot

Logo:

Logo
http://www.stackprinter.com

StackPrinter is a website that pulls the main details of a given question, all its answers, comments and votes formatting them in a simple essential printable view.

I've created this micro web application basically to add a "Printer-Friendly" feature to the Stack Exchange Network sites, trying to remove some @Media Print CSS limitations like hidden comments, pagination and empty spaces. (rationale here)

Other features:

  • Addons:
    1. Greasemonkey script - Adds a Printer-Friendly button on question's page (FF|Chrome)
    2. Bookmarklet - Allows you to print a question directly from question's page
  • Favorites: lets you browse and print favorites users's questions from:
    1. The Stack Exchange Network
    2. Delicious social bookmarking
  • TopVoted: top voted questions by tags
  • TopPrinted: StackPrinter top printed questions
  • Deleted: popular deleted questions archive
  • MySE: for printing all your Stack Exchange stuff

Demo

Printable question:
What should a developer know before building a public web site? - Stack Overflow
Recovering a lost website with no backup? - Super User
Good tools that fit on a thumb drive - Server Fault
Jon Skeet Facts? - Meta Stack Overflow
API Documentation and Help - Stack Apps

Favorites:
Jon Skeet - Stack Overflow
Jeff Atwood - Stack Overflow
Zoredache - Server Fault
wil - Super User
gangsta75 - Delicious

TopVoted:
python tag - Stack Overflow
discussion tag - Meta Stack Overflow

Deleted:
What's your favorite "programmer" cartoon?

Code

Language: Python
Platform: Google App Engine
Framework: webpy
Source: github
Api: /export
License: BSD

Info

Contact

Contact info

Credits

systempuntoout
  • 7,985
  • 4
  • 20
  • 27

4 Answers4

20

Addons

Stackprinter allows you to print directly from Stack Exchange sites using Greasemonkey script or an handy bookmarklet.
Greasemonkey script adds a Printer-Friendly button to the question you are browsing (Firefox and Chrome both supported).
Bookmarklet is useful if Greasemonkey is not an option and has the same effect of Printer-Friendly button, allowing the print of the question straight from the question page.

alt text

Favorites

Favorites allows you to browse and print your favorite questions or other users favorites.
Stackprinter supports all Stack Exchange sites plus Delicious social bookmarking service.
Just star or save your questions and browse Stackprinter to print all of them later.

Users search
alt text

Favorites result
alt text

[Q]uicklook alt text

Delicious result
link text

TopVoted

TopVoted allows you to browse and print the best questions searched by tags.

Tags search
link text

TopVoted result
link text

systempuntoout
  • 7,985
  • 4
  • 20
  • 27
5

I asked this as a question, but apparently the convention is to report bugs/feature requests in the announcement thread. It appears, that the MathJax extension mhchem is currently not enabled in the StackPrinter app. This is rather inconvenient for most of the chemistry.se questions and answers. It would therefore be nice if this feature could be enabled for the StackPrinter app.

Example:
Please consider the sandbox on meta.chemistry.se and its printed version (also see the screenshot below). You can see in the first equation of my post the red \ce. I enabled the mhchem package manually via \require{mhchem] after that and the same command renders now.

printed result

5

Here is a small script (stackprinter) which uses Stack Printer from the command-line:

#!/bin/sh
type wkhtmltopdf || { echo >&2 "wkhtmltopdf command is required. Aborting."; exit 1; }
: ${1?"Usage: $0 (url)"}
URL=$1 && shift
HOST=$(echo "$URL" | grep -Eo "([.[:alnum:]]*?)\.(com|net|org)" | head -c-5)
QID=$(echo "$URL" | grep -o "[0-9].*/" | head -c-2)
PRINTURL="http://www.stackprinter.com/export?format=HTML&printer=true&service=$HOST&question=$QID"
FILENAME=$(curl -s "$URL" | grep -o "<title>[^<]*" | tail -c+8)
wkhtmltopdf $* "$PRINTURL" "$FILENAME.pdf" && echo "'$FILENAME.pdf' saved."

Usage:

./stackprinter (url)

Example (tested on OS X):

$ ./stackprinter http://stackapps.com/questions/179/stackprinter-the-stack-exchange-printer-suite
'app - StackPrinter: The Stack Exchange Printer Suite - Stack Apps.pdf' saved.
tripleee
  • 163
  • 10
kenorb
  • 173
  • 1
  • 6
  • head -c-2 doesn't work on macOS, is the intent to get the first string of alphanumerics out of the URL? I guess sed 's/[^0-9]*//;s/[^0-9].*//' would do that in a single process. Of course, using parameter expansion would do it without any external process at all (but require several steps and maybe a temporary variable). – tripleee Jun 10 '21 at 04:25
4

The default bookmarklet javascript has problems when used with mathoverflow. Because annoyingly mathoverflow ends with a .net instead of a .com. I made some changes so that it could also work with mathoverflow (feel free to improve on it):

javascript:(
function(){
  var re = new RegExp('^https://(.*?)\.com/questions/([0-9]+)/');
  var group = re.exec(window.location.href);
  if (group==null)
  {
    re = new RegExp('^https://(.*?)\.net/questions/([0-9]+)/');
    group = re.exec(window.location.href);
  }
  if (group!=null)
  {
    var service = group[1];
    var questionid=group[2];
    window.open('http://www.stackprinter.com/export?format=HTML&service='+service+'&question='+questionid);
  }
  else
    alert('Attention: question id not found!');
}
)()
Jose Capco
  • 141
  • 2
  • Thanks for your contribution! Perhaps you could replace \.com with \.(com|net)? – Glorfindel Aug 11 '21 at 13:48
  • I know what you mean. I did not know how to make this work with RegExp but I don't think your suggestion works. I think it's a bit more complicated than that. Anyway, I tried it and it didn't work for me. – Jose Capco Aug 12 '21 at 13:52