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

Desktop: add support for printstyle.css #1700

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
6 participants
@tessus
Copy link
Collaborator

commented Jul 2, 2019

It is now possible to use custom css when printing and exporting notes to PDF
by placing a file called printstyle.css to the profile directory
(e.g.: ``~/.config/joplin-desktop`). This file supports standard css syntax.

Please note that Joplin has to be restarted for changes to this file to become effective.

add support for printstyle.css
It is now possible to use custom css when printing and exporting notes to PDF
by placing a file called `printstyle.css` to the profile directory
(e.g.: ``~/.config/joplin-desktop`). This file supports standard css syntax.

Please note that Joplin has to be restarted for changes to this file to become effective.

@tessus tessus added the desktop label Jul 2, 2019

@laurent22

This comment has been minimized.

Copy link
Owner

commented Jul 2, 2019

What's not currently working with printing that would make this necessary?

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 2, 2019

As a matter of fact, I just recently came across a convincing argument.

Besides that, some people might like to use a certain font or heading placement, when they print. e.g. Some others might think that changing the [toc] appearance could be useful.
There might be other reasons I haven't thought of, but you also mentioned that you aren't disinclined to the idea of a printstyle.css.

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 10, 2019

FYI: Another topic on the forum popped up: Another customized CSS for printing and PDF exporting

@sciurius

This comment has been minimized.

Copy link

commented Jul 11, 2019

Isn't this what @media print { ... } is intended for?

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 11, 2019

@sciurius userstyle.css is disabled for printing.

@sciurius

This comment has been minimized.

Copy link

commented Jul 11, 2019

Yes, I saw that. But what would be the benefits of having two distinct style files instead of a single file with appropriate @media sections? Especially since I expect the two styles to have a lt in common.

@laurent22

This comment has been minimized.

Copy link
Owner

commented Jul 11, 2019

It was disabled at some point because it's generally tricky to get the print css right, so it's done by the app.

Perhaps we should re-enable it then and just put a warning about it in the doc.

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 11, 2019

Perhaps we should re-enable it then and just put a warning about it in the doc.

Hmm, I thought all css was removed for printing, due to issues with printing when using the dark theme.
Also, I remember that the @media did not work for some reason, or am I remembering incorrectly?

Isn't the @media pragma for additional css, or does it make all previous css invalid? If the former, it won't be a real solution either.

I'm ok with solving it either way. @laurent22 you mentioned at one point that using a printstyle.css would make sense. That's why I even started this PR. I thought you just didn't have the time to look into it. I could not have known that you'd be reversing your previous opinion.

@foxmask

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

@sciurius

This comment has been minimized.

Copy link

commented Jul 11, 2019

IMHO the right way is to have a single css, and support @media.
Themes can be implemented by putting the appropriate content into userstyle.css. If the user already has a userstyle.css (or modified it) then the theme is Custom and cannot be changed via settings.

@tessus

This comment has been minimized.

Copy link
Collaborator Author

commented Jul 11, 2019

Well, in that case, please make the changes and submit a PR. How long will this take?

This PR is ready and it works. Proposing something that will take a long time does not help the people who want to customize their printouts now. I don't quite understand. We've also had a good discussion going on about supporting css across the board (desktop and mobile). It died down and nothing happened. We are no closer to a concept how to implement it. It also not a problem to backout this PR later. All I'm saying is that talking doesn't help (nor do endless discussions that lead nowhere) - adding code does.
If this is just a feature that is not needed by a lot of people, it won't matter that a handful of people have to transfer their css from printstyle.css to the other file. If it is, people will have to understand that Joplin is under development and that changes can happen. As long as we don't take features away, people will understand. e.g. I still miss Mermaid a lot, but I haven't had the time to add it back. Mermaid is for IT people what KaTeX is for mathematicians (I'm not saying IT ppl don't use KaTeX).

@desk7

This comment has been minimized.

Copy link

commented Jul 12, 2019

I hope printstyle.css will be implemented. It's up to aware users to set print-css right.

@sciurius

This comment has been minimized.

Copy link

commented Jul 12, 2019

@tessus: Actually it is the other way around. Joplin supports CSS stylesheets for display and printing. CSS has @media to select styles depending on whether it is being displayed or printed.
So this should already work unless it has been explicitly disabled.

@sciurius

This comment has been minimized.

Copy link

commented Jul 12, 2019

@tessus: Actually it is the other way around. Joplin supports CSS stylesheets for display and printing. CSS has @media to select styles depending on whether it is being displayed or printed.
So this should already work unless it has been explicitly disabled.

EDIT: See https://discourse.joplinapp.org/t/question-or-feature-request-css-tricks/1453/25?u=sciurius

@laurent22

This comment has been minimized.

Copy link
Owner

commented Jul 12, 2019

I didn't have a strong opinion about printstyle.css, I think I've mentioned it in passing, as a "maybe". Thinking about it I'm not so keen to add more code for this as it's an advanced feature which the vast majority of users won't need.

Instead I'd be tempted to just allow userstyle.css when printing (and @media will indeed allow customising printing) and see what feedback we get. We'll need to update the doc with this info.

@sciurius

This comment has been minimized.

Copy link

commented Jul 13, 2019

I think that with a couple of good sample css documents users will quickly find how to obtain the desired results.
Most important, we can point them to standard css documentation for details.

@charlesdaniels

This comment has been minimized.

Copy link

commented Jul 14, 2019

As a user, I would also really like printstyle.css, or being able to use user styles in printing.

Personally, I like a smaller, serif font, and also justified text. I also tweaked the border styles on tables to be to my liking. I would also like to have the option of using these settings for printing too.

I would be fine if it had a popup box that says "if you screw up your printing, that's on you" or something to that effect, since it certainly is easy to break. But for those who know CSS, it's definately a nice feature to have.

Also, I assume that the printing style would also be used for PDFs? I often export Joplin notes to send to others, and it would be nice to be able to control the style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.