notes icon indicating copy to clipboard operation
notes copied to clipboard

Overhaul Printing

Open newhinton opened this issue 3 years ago • 11 comments

Is your feature request related to a problem? Please describe. I would like to see an overhaul to the printing-process. Currently the user has to know that "printing the page" will only print the note rendered in markdown. That is a bit limited and i can see some improvements.

Describe the solution you'd like I would like to see dedicated printing-buttons somewhere. The Collectives-App has a button for that in each collective, but the notes app should have one on each note. Additionally, i think it would be a good idea to have a "print all" button per folder, where we build a pdf from each note, making each note-title the chapter-title, and depending on the nesting of that file, subchapters. This allows for printing "whole books" similarly to the collectives app.

This would work with the current category-approach, but it would be trivially to understand if we would also switch to a folder based concept.

Additional Context:

There is https://www.npmjs.com/package/markdown-pdf. Alternatives were discussed in #179. It worked fine locally, and as per documentation, concatenation works aswell.

newhinton avatar Nov 07 '22 09:11 newhinton

It also seems printing only works if the content fits on one site. If it is longer, it is trunkated. So i took the liberty to also add the bug-tag.

newhinton avatar Nov 12 '22 00:11 newhinton

I have build a tiny working prototype.

Its based on marked, jspdf, dompurify and html2canvas.

First marked converts the markdown to html, which then gets passed to jspdf. The rest is dependency for jspdf.

The upside is that we are independend of the DOM for printing, but we also have to provide a custom stylesheet to get a pdf that looks halfway decent.

newhinton avatar Nov 12 '22 14:11 newhinton

I appreciate your work, but wouldn't it be easier to just use pure CSS @print stylesheets?

A button (if planned and / or wished) could just trigger the native printing then - it would be faster and dependency-free...

stefan-niedermann avatar Nov 12 '22 15:11 stefan-niedermann

It was just a 10 minute prototype, so no time lost ;)

I don't think the css is the problem, but how we display the note.

Granted, i have not looked that deeply into it, but currently printing the file via native printing just cuts off everything that is not in view by the dom. (vertically and horizontally) If this is just a tiny bug somewhere, then yes, a native version could be better. But i have not looked into that too much.

newhinton avatar Nov 12 '22 15:11 newhinton

Granted, i have not looked that deeply into it, but currently printing the file via native printing just cuts off everything that is not in view by the dom. (vertically and horizontally) If this is just a tiny bug somewhere, then yes, a native version could be better. But i have not looked into that too much.

Yep, that looks like a bug. This may have come with Nextcloud 25, since there was an overhaul of the scroll areas. It definitely has worked in the past (with older Nextcloud server versions). Therefore, I think fixing that bug would be better than introducing complex PDF generation. And to be honest: how many people print out their notes?

korelstar avatar Nov 13 '22 20:11 korelstar

And to be honest: how many people print out their notes?

Yeah, you are probably right about that. We should at least fix that though ;)

And then, later, we could introduce a print button sometime later when the toolbar has been merged.

newhinton avatar Nov 13 '22 20:11 newhinton

And to be honest: how many people print out their notes?

it's not like they could if they wanted. (I already almost went into a meeting with the single visible page printed and the rest missing. do not recommend)

FlorianHeigl avatar Feb 09 '23 23:02 FlorianHeigl

I just came across this - I think it's mandatory to be able to print out notes (which is not possible in an easy way as of today). Please include this; the sooner the better.

petrarca-arezzo avatar Jul 17 '23 16:07 petrarca-arezzo

Related:

nextcloud/text#4536 (since fixed in nextcloud/text#5054)

joshtrichards avatar Aug 09 '24 13:08 joshtrichards

I would also appreciate it if we could fix the @print stylesheet.

With a bit of experimentation I removed the sidebar from the print preview ... but the issue that it's only printing the first page is not solved. (tested in Firefox 128 and Chromium 138)

I tried borrowing things like height: fit-content!important; from https://github.com/nextcloud/text/pull/5054 but no luck sofar.

diff --git css/notes.css css/notes.css
index a64d3a61..dfa7e8e5 100644
--- css/notes.css
+++ css/notes.css
@@ -63,7 +63,10 @@ body[dir='rtl'] .feature {
        #header,
        .app-navigation,
        #note-container .action-buttons,
-       #note-container .upload-button {
+       #note-container .upload-button
+       div div.content-list,
+       .splitpanes__pane-list {
+
                display: none !important;
        }

helmo avatar Jul 17 '25 20:07 helmo

I'd like to add here that people might want to "print to PDF" for example, not for actually printing to paper but for other purposes.

I, for example, am part of a foundation where we use Markdown files for meeting minutes. Sometimes however, we need to sign those. To do that, we installed the LibreSign app in our Nextcloud instance. To actually sign anything however, it needs to be a PDF file. Try as I might, I've not seen a simple markdown-to-pdf conversion option. The closest I've come is to print to PDF and re-upload the meeting minutes. Not ideal, but at least its something.

mvdkleijn avatar Aug 03 '25 13:08 mvdkleijn