Печать темы в формате PDF

:bookmark: В этом руководстве объясняется, как распечатать или скачать любую тему Discourse в формате PDF.

:person_raising_hand: Требуемый уровень доступа: Все пользователи

Discourse позволяет генерировать PDF-файл темы с помощью сочетания клавиш Печать темы. Сочетание клавиш для вашей системы указано в модальном окне справки по сочетаниям клавиш, которое появляется при нажатии клавиши ? во время просмотра сайта Discourse.

  • Большинство операционных систем: ctrl+p
  • MacOS: +p

Использование этого сочетания клавиш откроет новое окно браузера, где вы сможете при желании выбрать печать темы в формате PDF. Интерфейс может отличаться в зависимости от браузера, но он будет выглядеть примерно как на примере ниже:

Дополнительная информация

  • Discourse перехватывает сочетание клавиш и отображает печатную версию на стороне сервера, чтобы гарантировать печать всей темы.

  • Аналогичную функциональность можно активировать, добавив /print в конец URL-адреса темы.

  • Технически вы также можете выбрать опцию печати в меню Файл вашего браузера, но, скорее всего, вам придется прокрутить страницу от первого до последнего сообщения темы, чтобы убедиться, что все сообщения загрузились.

  • Существует настройка сайта max prints per hour per user (максимальное количество печатей в час на пользователя), которая позволяет администратору установить максимальное количество показов страницы /print в час на пользователя. По умолчанию значение равно 5, его можно установить в 0, чтобы отключить функцию печати тем в Discourse (печать через меню браузера при этом продолжает работать).

30 лайков

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?

4 лайка

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.

5 лайков

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 лайк

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 лайк

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

10 лайков

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).

6 лайков

Okay so no button on mobile?

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

2 лайка

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

5 лайков

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

4 лайка
  • 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 лайка

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

3 лайка

I would also like to know

3 лайка

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 лайк

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 лайка

: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 лайков

I think finally I found a good solution

  • We don’t have to output as pdf.
    We can output the full webpage as html file.
    Simply use the SingleFile in the chrome webstore, it will download and compress the full webpage as it is and save to a html file.

  • If you want to print to pdf, use the downloaded html file to print, and it will keep all the formats in the html file.

2 лайка