SeaPrint - Network printing for SailfishOS

SeaPrint does this just fine.

Edit:
On a second reading; it doesn’t do pause because i never understood how/why that is a thing.

2 Likes

With non-IPP printers via a local cups server on the phone too? I have not tried yet.

Yes, any printer added to CUPS, and shared by CUPS is shared over IPP (from CUPS).
localhost as a network interface for IPP should just make configuration even easier (it is on by default afaik).

I never got this working on SFOS for my old beloved -now gone :(- DJ1120C.
(replaced by a OJ7000 Wide, also non IPP ;))
Or let’s say cups was running fine but the printer driver/filter never ever managed to output or accept any normal txt/pdf input. Iirc a jpg was once printed…

Exactly here I gave up, after long inet search and many compilation trials…

I`ve checked but I have the latest version installed. (from 2019)

You know the game Pin-pong? I told Brother about the Problem and asked them to fix it with a new update. The answer was a link to the Firmware update site. And if this had no success I should contact you about an update. That`s crazy.

I have an Idea for a Solution. Can you add a sub-page (maybe called advanced support) to your Configuration-Menu where the user can select what information is shown on the main page.

On this side are this two points for Example:

  • printer-name (selected by default)
  • printer-info

If someone contacts you in the future because the printers name is not shown or shown as “unknown”, you can view their log. When you see the Point “Printer-Info” includes the name of the printer, than you can say “go to the Configuration-menu. Tab on the “Advanced support”, and select printer-info.”

I don`t know how much work it is for you. But i think if you finished it you can help people much better.

Yes that is silly indeed.
That’s big companies for you; the person responding probably didn’t even have the technical knowledge to independently reason about whether not following the standard (in spirit at least - one could argue an empty string still is a name) is an issue. Reading the standard a bit more, these attributes are meant to be set(-able) by the administrator. So while i doubt they bothered implementing that, it could be worth checking the configuration web page.

As said before, i’ll (probably) make it possible to configure overriding names to be shown locally in the app.
Adding an option to point the name field to the wrong attribute is not a good general-purpose solution.
Making it fully configurable solves both your issue, and enables other use cases, like telling printers with same/similar names apart.

I know. Thank you for that.

Whit this post I only would let you know what Brother says to my request.

I don’t think Brother bothers fixing a missing name information for this rather niche use case. It would be great if companies actually stuck to the standards. This is why we can’t have nice things.

(I’ve had my share of troubles with Brother devices, and for the average Joe the support is actually quite ok.)

Oh! I bought an Epson EcoTank ET-2714 printer, and of course it doesn’t support IPP but this janky Epson something something protocol. Why can’t we have nice things? (All we get is niche things, ha!)

Me neither, but SeaPrint can hardly be the only IPP client expecting name to actually say something?
I’d bet CUPS and Android’s whatever the built-in printer support is called has similar issues, although they may have a solution too.

Aaaw :slight_smile: I thought everything had at least AirPrint nowadays.
So weird even CUPS won’t have it?
(I vote send it back if at all possible)

Change of plans for overrides… I will not make this in the GUI at this point in time.
Whatever i would have ended up doing would have been too niche, and not cover nearly enough use-cases.
Opening up overrides of single attributes, and formats especially risks being a Pandora’s box of support questions.
I can only imagine things like: i manually selected PDF support, but it doesn’t work with my printer.

Edit: And the reasonable thing to remember printers by is uuid, but not all printers have it, especially those needing format-overrides. Both using something else, or leaving out those users seems suboptimal.

So i’ll make something that is super generic, and where being complicated is a bit of a feature - it should be clear that here be dragons, and that the user is experimenting.

Okay, okay, cut to the chase.
I’m thinking a config file (need to sort out exactly where to put it), where the user can add his or her own overrides.
The (JSON) format of the file is as follows; if a key in the overrides also exists on the printer, and the value of that attribute on the printer exists as a key in the overrides below that first key, then take whatever is there and replace those things in the printer attributes.

Example:
@Se whose printer has a nice uuid, could do this to set a name:

{
  "printer-uuid": {
    "urn:uuid:e3248000-80ce-11db-8000-30055c0d2e59": {
      "printer-name": {
        "tag": 54,
        "value": "Se-printer"
      }
    }
  }
}

Extending it to fixing up model, marker names/colors etc is also very possible.

@dexic whose printer does not have a uuid, but he has reason to believe has Postscript support could do something like this (matching on printer-name instead):

{
  "printer-name": {
    "KMB66169": {
      "document-format-supported": {
        "tag": 73,
        "value": [
          "application/octet-stream", "application/postscript"
        ]
      }
    }
  }
}

Unless i hit some major snags, i’ll push this later today… but store release might be another day or a few.

This is experimental and WILL break eventually, hopefully due to improvements.

Edit: published

For location of where you should put the file, see release notes. (It will likely move, and i won’t be able to edit this post later)

I *had* a HP LaserJet “Pro” MFP M28-M31, which must be named after the fact that it breaks down after printing around 28 to 31 pages. I have to bite my tongue hard not to describe how awful time I had with it.

The Epson works like a clock though! And I can install the printer driver to my RPi and turn it into a printer server if I really want to print something from my Sailfish phone. Photos come to mind. Is it possible to set up paper size and type using Sailprint?

<nerdsnipe>
The protocol is actually ESC/P-R which sure is Epson proprietary, but the Linux/CUPS driver it’s public, licensed under GPLv2 and the sources are freely available! Wikipedia tends to speak of it in past tense, but it is still the only way to print using CUPS (Linux/Mac) and the driver is maintained (last bug fix about a month ago). Brand new Epson printers still keep supporting the protocol, so I don’t really know what to make of all this… But at least it’s open source and it works - I can sure live with that :slight_smile:
</nerdsnipe>

1 Like

SeaPrint - You know like that other printing system, but fishier? :wink:

Size is definitely configurable, along with paper source… but i’m honestly not read up on types.
There are some in the cluster that is “media-col” attributes, but those are standardized, and i’m not sure that is what you need.
I’d really want to avoid supporting media-col properly (due to the complexity), but somewhere in the back of my mind i know i probably should.
When you have it set up, and feel a need for paper type selection, see if you feel something is missing… and reach out so we can dissect the printer attributes. (The “media-col-database” will also need to be queried separately)

Only recently I found that with ImageMagick (available in openrepos) can take a text file and output a pdf with:

convert text:input.txt output.pdf

For reasons I don’t understand, I couldn’t just share via seaprint from the Jolla notes app – it doesn’t like to share that way. I wanted to print the contents of a text message (my mother-in-law sends recipes for her and my daughter to simultaneously cook via skype). I had been forwarding the text to google voice/hangouts open on a real computer, which of course worked as expected.

But now SeaPrint saves the day! Once I saw what convert could do, I grabbed the text, pasted it into nano to clean up as necessary and save to .txt, convert to pdf, open in documents and print via seaprint. Seems like more steps, but so much more satisfying to do it all on the phone. I probably get put on nerd probation for not saving the text message to .txt file with one line of bash, possibly involving cat and echo, so shame on me.

And when did SFOS browser add “save to PDF”? That plus SeaPrint is a pretty powerful combo!

Sharing is per file type, and plaintext is not among the supported ones.
It shouldn’t show SeaPrint if you have a plaintext file in Sailfish Office either.
Come to think of it, the sharing plugin version supporting sharing “office” files isn’t published yet, because the dependency is coming later.

I would really like to support plaintext, i just haven’t figured out a good way to do it.

So currently we are limited to PDF and images, and Postscript for natively capable printers.
Well, technically office documents work too if you install calligraconverter, but that’s not readily available until the next version of Sailfish.

A difference compared to other OS:es, is that here everything is done in SeaPrint, no apps actively have print support and hand over the content in a good intermediary format (yet?).

I tried convert for doing plaintext to PDF, and at least if i set density it looks alright.
But it doesn’t help with text reflow… so i’d still have to do that myself, which is similar to printers with native plaintext-support, so maybe being similar is good.

Another aspect is that having dependencies for handling plaintext feels silly, especially a third one. I should be able to write my own text-to-pdf application and include it, but that’s probably a bad idea.
Maybe if i can ease installation of dependencies somehow, i can sneak in another.

I should also poke at calligraconverter some, to see if it can be added, but time and such…

1 Like

Not sure if it has come already up in this (long) topic, or if you’ve otherwise thought of it, but have you tried creating a QTextDocument, setting the plaintext as HTML content with no tags and creating a pdf by printing to QPdfWriter? (I’ve some code like that in a project, which of I’m not quite sure if I’ve actually tested if my code works on Sailfish device, but I think I’ve at least successfully compiled that in SF IDE…)

1 Like

Thank you, they had not been brought up - especially as a pipeline.
I’ll poke around and see how it does for reflow and pagination (i’m thinking having one without the other will be hard - and having neither is too much work) but it looks promising.

It should take care of printing images to PDF/Postscript-only printers too. Might help some people with old-but-fancy printers.

I had seen QPdfWriter, but it had slipped my mind since… my Sailfish apps are the extent of my Qt experience, so still getting used to what is available. As an aside, the key enabler for SeaPrint, my Bytestream class, is basically a reimplementation of QDataStream. Still happy i did it though.

1 Like

QTextDocument+QPdfWriter is definitely the way to go, but it doesn’t mean it is going to be easy.
All API:s dealing with sizes are a complete mess. Different units, different size types, missing units in the documentation and all sorts of wonderful things. :confused:

It also doesn’t seem to care about form feed, but maybe i shouldn’t either… or do some HTML magic.
Anyway, that’s solidly secondary priority for now.

I ended up using setPlainText() instead to have it respect newlines and do proper reflow, and i’m using print() to write to the QPdfWriter. Let me know if either was a bad idea and should be re-evaluated. Any hints on getting sizes working would also be much appreciated.

It will happily claim to be A4, but font sizes are all over the place… and the best i could get so far has 8pt being closer to 11 on the actual page. My plan/wish is to make A4 and letter have 60 lines of text, and anything else gets what it gets from the logic that does that.

Nice idea.

But where can i find the “~/.seaprint_overrides”. I have installed Filebrowser and it shows hidden files but did not found this folder?

It is a file, and you will have to create it.
~ means /home/<username>, so create a file named .seaprint_overrides in your home directory.

1 Like

your example works very fine. now I have my printer name. thank you.

On the UI i see now:
Brother mfc …
unknown
ipp:…

I tried this in the override file:

“printer-uuid”: {
“urn:uuid:e3248000-80ce-11db-8000-30055c0d2e59”: {
“printer-name”: {
“tag”: 54,
“value”: “Brother MFC-9340CDW”

   "pinter-make-and-model": {
     "tag": 53,
     "value: "test"
    }
  }
}

}
}

And the result in the ui is:

Unknown
unknown
ipp:…

what is the issue?