Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul Printing #936

Open
newhinton opened this issue Nov 7, 2022 · 9 comments
Open

Overhaul Printing #936

newhinton opened this issue Nov 7, 2022 · 9 comments
Labels
bug Something isn't working enhancement New feature or request needs discussion Need to clarify if and how we should implement this

Comments

@newhinton
Copy link
Contributor

newhinton commented Nov 7, 2022

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 newhinton added needs discussion Need to clarify if and how we should implement this feature request Requests for complete new features bug Something isn't working labels Nov 7, 2022
@newhinton
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@stefan-niedermann
Copy link
Member

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

@newhinton
Copy link
Contributor Author

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.

@korelstar
Copy link
Member

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?

@newhinton
Copy link
Contributor Author

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.

@FlorianHeigl
Copy link

FlorianHeigl commented Feb 9, 2023

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)

@petrarca-arezzo

This comment was marked as duplicate.

@juliushaertl juliushaertl added enhancement New feature or request and removed feature request Requests for complete new features labels Jul 20, 2023
@joshtrichards
Copy link
Member

Related:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request needs discussion Need to clarify if and how we should implement this
Projects
None yet
Development

No branches or pull requests

7 participants