Print long topic to PDF, redux, again

Perhaps the word “printing” should be removed from the topic title.
AFAIK, no one really wants to print to paper.

###However, there are at least two very good use cases to have an option to display the entire topic:

  1. Create an PDF from the full topic, that can be used to:
  • Read and annotate offline (like on a plane).
  • Provide as a reference for management or your team
  1. Clip to an Evernote Note
  • Same uses as #1.
  • Have as a technical reference that can be tagged, linked to, and annotated within Evernote.
  • Be available for searching along with other Evernote Notes.
  1. Clip to other Knowledgebases, like DevonThink.

I don’t see having this “full topic display” feature would have any significant effect on the normal usage of a Discourse forum.

Thanks for considering this feature request.

11 Likes

I would like to bring this issue back up.

Recently started a paid business hosting plan and it is a big deal for a lot of my users to be able to print a full topic.

There are a couple reasons for this. But it is mainly for posterity.

My organization is heavily focused on research and the various members want to print and save a thread in their personal archives or with their own research.

Secondly my demographic is often older than on a lot of sites. Telling them to turn off javascript in their browser so they can print a thread would be such a foreign concept to many of them that I would sound like an idiot even suggesting it. Many of these people also print it so they can read it on the paper, and not at their computer.

It is something that is very important to the users on my site that I need a solution for.

In my opinion, the best solution for me would be a button that says [Print View] on each and every thread, and opens up a new tab without the infinite scrolling and with the pagination turned on - similar to how it would look if i load the thread with javascript disabled.

6 Likes

Sure – open to that. We’d need some kind of minimum viable design to start, and decide if it is core or plugin.

6 Likes

I would also be super excited to sew this feature. Sitting here in Tanzania with members of my community it is striking how helpful this would be.

Perhaps a good spot for it would be on the link popup, as a printer or (I think better) download glyph. When selected from the post menu it would just download the one post in a single PDF. From the topic menu it would download the whole topic in a single PDF.

2 Likes

I’m taking a shot at this, in a lightweight approach.

6 Likes

So I have a basic version of this in my fork:

  • It renders the no-js crawler version.

  • It renders a big html with 1000 posts per page

  • It’s rate limited by 10 prints / user / hour

  • You can use your browser/SO/virtual printer to convert to PDF (1000 test posts is 277 pages, 6.1MB)

I will probably add some CSS now (emojis are huge), anything else I forgot?

15 Likes

Awesome that you are working on this and have come so far. Thanks so much! :sunflower:

If the output is a 6.1mb pdf, maybe a better approach would be to process it in the background and deliver it via PM when finished?

1 Like

I think he is stating, using the Print > Save as PDF in your browser, or using a virtual printer that prints to PDF on your computer. It isn’t being converted to PDF on the server. If that is the case, moving it to a scheduled job won’t solve anything, but I could have misread that.

6 Likes

Exactly @cpradio. Discourse is just generating html.

4 Likes

It’s a start. I’ve done the must have parts, but there’s probably something I forgot.

14 Likes

So has this been merged yet?

Subtly dealing with whisper I think exisits here…

1 Like

I’m fixing my mistakes in the PR with help from @tgxworld and @zogstrip. Also we are discussing enabling by default with a small limit.

6 Likes

Anything up with this? I have an academic user who needs to export entire discussions for offline analysis.

1 Like

We weren’t able to come up with anything we liked here, so we kinda put it on the back burner.

My solution is going to be a client-side parser that’ll take a topic URL and spit out something vaguely resembling in Mbox file.

First version is a go on Meta :tada:

  1. Go to a long topic: The State of JavaScript on Android in 2015 is... poor

  2. Press CTRL+P

  3. :printer:

17 Likes

The quote styling is a bit funky :slight_smile:

5 Likes

Looks great!

I’ve noticed on Firefox that I sometimes get the browser-native print dialog pop up immediately, then your new popup window once I close the print dialog, and then the desired print dialog. I also noticed that the popup-blocker kicked in – so is the keypress perhaps not prevent propagation of the event, and is it perhaps opening the popup after an async call, rather than as a direct result of the keypress?

Exactly. I couldn’t find a way to properly stop propagation on the print event. (it doesn’t look possible)

1 Like

I don’t know if it’s possible on the print event, but it’s possible on the key combo. (I didn’t know there was a print event!) Note that you can’t use keypress – that only works in Firefox, as the other browsers seem to handle the default print in keydown.

Here’s the super-simple approach:

https://jsfiddle.net/0kch2s63/2/

It works correctly in both Firefox and Chrome. Unfortunately in Edge you still get the printing popup – but the event is handled appropriately. Not sure about Safari – I don’t have a Mac on me at present. :slight_smile:

3 Likes