SeaPrint - Network printing for SailfishOS

Ok. Kind of a bummer but i understand why it is that way. Anyway.

@atah
I have an issue. When taping the icon to see the list of documents on the device i see none. It says to copy some on the device. I have mainly .txt files and pdfs.

What gives.

Hmm… so as you might guess i found a way to do what you asked for, but not very nice if it breaks.
You should™ only see PDFs and Postscript. I assume you see your PDFs in the documents app? Do you also see them in the attachment selector in the email app?

Do stop by on IRC if you have some time, i’ll be there another couple of hours.

Edit: tested fresh installs on both 4.0 and 3.4… both works :confused:

I think i found the bug. Whatever you did is case sensitive. Ie. myfile.pdf works, myfile.PDF doesn’t work.

Haven’t tested extensively though.

That sounds correct. I thought it was that way before too, but perhaps it had some magic. It’s an easy fix to at least include all-uppercase file suffixes. In the meantime; may i recommend the sharing plugin on openrepos?

I started messing around with supporting more file formats, but it’s not so easy.
For doc(x), odt etc, calligrawords has a command line option to convert to pdf that i could probably lean on. Supposedly there is also the more generic calligraconverter, but even the version that ships with my Linux distro segfaults no matter what i throw at it. The same goes for calligraconverter on SFOS. It was fairly easy to add that to the sailfish-office build, but adding calligra-words seems not so easy.

Then there is plaintext; how hard can it be?
Very, apparently.

My one printer that supports it definitely wants \r\n newlines, so i’ll need to re-linebreak files that i send over. Not too terrible, but using any sort of readily available readline functionality, it seems i will lose track of any \f characters.The horror!

And since plaintext support seems quite rare, i’d like to render my own in PWG/URF raster images.
I don’t think i want it more fancy than the standard 72*60 monospace characters per page, but still. For example; should there be any reflow at all? And in that case, keeping track of the number of lines or page fitment gets quite hard.
…and the same thing about \f goes for this too.

Or i could lean on some existing tool to go via PDF, but there doesn’t appear to be a standard tool for this, just oddball stuff.

Surely there must be a better way, especially with all the fancy Qt stuff available…
If anyone wants to pitch in, or just help me think, please get in touch!

1 Like

There are certainly multiple ways to go here. One way could be using a2ps, ps2pdf and friends. Or indeed go the QPrinter way. Or perhaps check how the “download as pdf” feature in the browser is implemented? Sorry, I probably didn’t help much
:roll_eyes:

3 Likes

You itch my curiosity here. I’ll try to look at that segfault and see if it can be cured without too much pain.

3 Likes

Here is the merge request upstream to fix some of the crashes encountered in calligraconverter :
https://invent.kde.org/office/calligra/-/merge_requests/19

I still need to investigate why it still insists on opening a window when called with --batch option, but at least it converted the ODT files I tried to throw at it, into PDF ones. Having this GUI opening may be problematic under Sailfish for your use case.

If fixes are accepted upstream, I’ll make a MR in SailfishOS to upgrade Calligra to latest upstream.

3 Likes

Thank you very much!
Since i’m quite curious, i hand-patched that into the SFOS packaging of Calligra and compiled it.
Unfortunately that still segfaults, maybe due to that GUI you mentioned having failed to instantiate?

All i did to get calligraconverter to build there was to add APP_CONVERTER to -DPRODUCTSET in calligra.spec. (Then the build will fail/complain that the resulting binary is not packaged, but i just grab it from there and fling it over)

Also, it needs a LD_LIBRARY_PATH=/usr/lib/calligra-kf5/ to run.

1 Like

Thanks for pointing to a2ps, i guess that is as standard as it gets. But wow, is it opinionated by default. I managed to dumb it down with a handful of switches - i want something simple enough to not get complaints on that it does something wrong. People whining about wanting it to do something more complicated are easier to dismiss :slight_smile:

Do you mean using actual QPrinter? I guess that is a no-go since it won’t be allowed in harbour (or i could make a stand-alone thing that uses it, but still). Or do you mean that wanting to render text on QImages sounds suspiciously similar to what i would have to do in order to make use of it? I guess that is what i’d prefer to avoid if reasonable.

I didn’t try the patches on SailfishOS version, I’ve created a MR to upgrade to latest upstream Calligra and apply the patches there, see https://git.sailfishos.org/dcaliste/calligra/tree/converter

It seems to work for the ODF files I tried it with. Is the ODF files you tried, open properly in the document application ?

1 Like

Hmmm, maybe it got fixed by someone else and came for free with the uplift. Or maybe the rebuild heuristics aren’t quite right and all files didn’t get recompile. Anyway, it doesn’t really matter really. Great job!

I failed, as always, to get git to actually show the right files. (fatal: remote error: Please use the https: protocol to connect to anongit) Maybe upstream had moved? Anyway git couldn’t just trust your repo and was being stubborn. Did i mention i hate git? :slight_smile:

So cloned anew and on to building, and here i’m pretty certain that it is a matter of PEBKAC… I’m building with a sfdk apply and sfdk build, and several dependencies could not be found… i guess that was a requirement for the uplift? But where should i have found those, and how do people that actually know what they are doing build things?

Edit: and i was just going to ask if we could/should propose to package calligraconverter in the official builds, but you go there first. Would be very nice if i didn’t have to maintain packaging that.

Well that’s indeed the idea that it gets compiled and distributed officially yes. I’m pretty sure it could, at least in a separated package, but hopefully installed by default (maybe).

For compilation, I don’t know, never used sfdk, I should but I’m accustomed to my routine of running the docker, and typing there mb2 -t SailfishOS-4.0.1.48-armv7hl -s rpm/calligra.spec build. It’s indeed doing all the download for the dependencies… I guess that sfdk is doing the same thing, but I’ve no idea and cannot help, sorry : ( I’ve seen in the release notes of the latest SDK that they fixed an issue with the docker not having the repository listing refreshed or something like that. Maybe it’s your case ?

The patches for Calligra have been accepted upstream earlier today, so tomorrow, I’ll rebase my work in SailfishOS on upstream/master and submit a MR for converter inclusion. We’ll see.

1 Like

Excellent news.

I still have to figure out why it doesn’t like the deps for this, but the old mainline version was just fine.
mb2 did indeed yield the exact same results.

I’ve just opened a merge request in SailfishOS git to add support and compilation of the calligraconvereter tool, see https://git.sailfishos.org/mer-core/calligra/merge_requests/56.

I could try to build it on OBS for easier testing on your side.

3 Likes

Thank you! I’ll build myself again tonight, and do an actual install with enough time to revert.

Just for the benefit of those following along here. I finally got the new version of Calligra to install, and it works great (as expected).
Now i can start plumbing it in to SeaPrint.

8 Likes

Oh wow, how did I miss this thread?! Thanks for creating and developing this app even further!

Now, if I only had a printer… :laughing:

1 Like

Still some improvements and clean-up left, but everything went quite smoothly.

1 Like