This guide explains how to print/download any Discourse topic to PDF.
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:
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).
Quindi seleziono più post e li scrivo in un nuovo argomento in una sequenza logica, e poi stampo questo argomento completo. Quindi elimino l’argomento completo.
Come se volessi scegliere il post 1, 3, 4, 5, 7, 12, per formare un argomento di sequenza logica, che sarà una storia completa, e poi stampare questa storia selezionata.
Questo sembra efficace ma un po’ distruttivo. Suppongo che non sia troppo difficile riassemblare gli argomenti in questi giorni grazie a questa funzionalità:
Dobbiamo ancora documentare questi elementi, ma nel frattempo date un’occhiata ai seguenti componenti del tema:
GitHub - discourse/clean-export (Aggiunge un pulsante ai controlli di amministrazione del post per stampare un post specifico. Sembra essere solo per TL4 e Staff. Mobile e Desktop)
GitHub - discourse/discourse-topic-print-component (Aggiunge un pulsante alla timeline dell’argomento per eseguire la stessa azione della scorciatoia da tastiera. Viene visualizzato per tutti gli utenti. Solo desktop.)
GitHub - discourse/discourse-topic-print-component 3 (Aggiunge un pulsante alla sequenza temporale dell’argomento per eseguire la stessa azione della scorciatoia da tastiera. Mostra per tutti gli utenti. Solo desktop.)
È possibile aggiungere il supporto per dispositivi mobili?
Tenetevi forte tutti, al momento non abbiamo nemmeno argomenti di documentazione per questi due componenti! Salviamo qualsiasi altro feedback/richiesta per quando potremo occuparcene. Nel frattempo, questi sono open source e con licenza MIT, quindi sentitevi liberi di fare un fork e/o una pull request se avete esigenze particolarmente urgenti.
Penso di aver finalmente trovato una buona soluzione
Non dobbiamo esportare in pdf.
Possiamo esportare l’intera pagina web come file html. Basta usare SingleFile nel Chrome Web Store, scaricherà e comprimerà l’intera pagina web così com’è e la salverà in un file html.
Se vuoi stampare in pdf, usa il file html scaricato per stampare, e manterrà tutti i formati nel file html.