Printing a topic as a PDF

:bookmark: This guide explains how to print/download any Discourse topic to PDF.

:person_raising_hand: Required user level: All users

Discourse allows you to generate a PDF of a topic by using the Print topic keyboard shortcut. The shortcut for your system is noted in the keyboard shortcut reference modal that pops up when you press the ? key while browsing a Discourse site.

  • Most operating systems: ctrl+p
  • MacOS: +p

Using the shortcut will open a new browser window where you can optionally choose to print the topic as a PDF. The interface will vary by browser, but it will look something like the example below:

Additional Information

  • Discourse intercepts the keyboard shortcut and renders the print view server-side to ensure the entire topic is printed.

  • The same functionality can be triggered by appending /print to the end of a topic’s URL.

  • You can technically select the print option in your browser’s File menu as well, but you will likely need to scroll from the first post to the last post of the topic to ensure all of the posts have loaded into view.

  • There is a max prints per hour per user site setting that allows an admin to set a maximum number of /print page impressions per hour per user. It defaults to 5 and can be set to 0 to disable Discourse’s topic printing functionality (printing from the browser menu still works).

Last edited by @tshenry 2024-08-01T01:14:43Z

Last checked by @hugh 2024-07-02T05:14:01Z

Check documentPerform check on document:
29 Likes

It is very good to output all contents to a pdf file.

While I found it slightly changes the format of the contents when using sub-items.

Like the output of this content

  • Level1
    • Level2
    • Level2
      • Level3
      • Level3

But when printing to pdf file, all items will be aligned left like all are level1 items.

Is there anything we can do, like setting something, to printing just as it is in the HTML view?

3 Likes

Also, is it possible to only print a single post? I get an error if I try https://meta.discourse.org/t/printing-a-topic-as-a-pdf/160061/1/print

This would be very helpful for Topics which have a valuable OP and a bunch of less valuable replies.

Currently not. Tobias shared that the team might look at it at some point.

4 Likes

Well, I have a way to solve this.

I usually make a new post for printing.

Then select multiple posts and write them in a new topic in a logical sequence, and then print this full topic. Then delete the full topic.

Like I want to choose the 1, 3, 4, 5, 7, 12th post, to form a logical sequence topic, which will be a full story, and then print this selected story.


Great, This must be the best way!
Printing a topic as a PDF - #19 by nathank

1 Like

This sounds effective but a little destructive. I guess it isn’t too hard to reassemble Topics these days though due to this feature:

1 Like

We still need to get these documented, but have a look at the following theme components in the mean time:

10 Likes

Can you post a ss of each?

I found the print post in post wrench. But cannot find other button

Installed both.

I get a nice little printer top right. It doesn’t show if DiscoTOC is active though:

The image displays a calendar with the month of January highlighted and a date selected on it.  (Captioned by AI)

Personally, I’d find it better if it was also in the topic options down the bottom (or better yet, we could choose between the two sites).

5 Likes

Okay so no button on mobile?

At least not that have noticed. I have the print single post in the post wrench menu.

2 Likes

I updated my post above with screenshots and some extra details.

5 Likes

Do you think this support would go official? Coincidentally today there was interest in exporting/sharing a topic :smiley:

3 Likes
  • GitHub - discourse/discourse-topic-print-component 3 (Adds a button to the topic timeline to perform the same action as the keyboard shortcut. Shows for all users. Desktop only.)

Is there a way to add support to mobile?

2 Likes

This is helpful when you are in a hurry. It is so efficient.

3 Likes

I would also like to know

3 Likes

There is already support to mobiles, to iPhones anyway (screenshot is from iPad/DiscourseHub, though)

Don’t let strange language scare you. But same functionality is founded from all mobile systems, I’m sure.

So Discourse doesn’t need offer a functionality that a device offers already. And it should’t do it.

I don’t see it on Android

A bit narrow minded as desktop already offers Ctrl+P. One could make the same conclusion adding a direct button being unnecessary. :wink:

1 Like

Are androids really that limited :thinking: I mean that has been basic functional ages.

It could be narrow minded but I can’t see no point what so ever having over lapping menus. Because then Discourse should offer pure cut, copy and paste too.

But if, or I should say when, out there is systems that don’t offer pseudo printing/saving as PDF then that is needed.

2 Likes

:sweat_smile: Hang tight everyone, we don’t even have documentation topics for these two components at this point! Let’s save any more feedback/request for when we can get around to that. In the mean time, these are open source and MIT licensed, so you can feel free to fork and/or make a pull request if you have particularly urgent needs.

7 Likes