Coder Social home page Coder Social logo

benoitduffez / androidcupsprint Goto Github PK

View Code? Open in Web Editor NEW
225.0 225.0 66.0 2.76 MB

Port of cups4j to Android. Allows wireless printing from any Android device to any CUPS-enabled print server or network printer.

Home Page: https://benoitduffez.github.io/AndroidCupsPrint

License: GNU Lesser General Public License v3.0

Kotlin 99.18% Shell 0.82%
android android-printservice cups4j

androidcupsprint's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

androidcupsprint's Issues

Only work the first time after installation

Environment:
Canon MP230 connected to a raspberry pi with CUPS installed.
I'm able to print without any problem using 2 different PCs and an iOS device.
The app was tested on a LG Spirit H440N with stock OS (Lollipop) and root permission.

Description:
After installing and setting up the app was able to correctly detect the printer and send a file to print. The same file could be printed more than one time without closing it. After switching to any another file the printer was still correctly detected but after a while an error message claiming that the printer wasn't ready to print appeared. Deleting the app data or rebooting the service and the device didn't help. However reinstalling the app let me print again one file, after which the issue recurs.

Publishing on f-droid.org?

Maybe this is already on your roadmap? The Jon Freeman Version is in f-droid but quite outdated and unmaintained.

Need info while connecting to printer(Canon MF210 IPPS printer)

Hi,

Thanks for putting this code on git hub. I have a canon MF210 printer that support IPP/IPPS. I have also shared the printer from my MAC. So when I install the android cups printer service on my device, I am able to detect the printer as well as the shared printer of my MAC.

I am able to send print requests through the shared printer of my MAC. But when I select printer directly I am getting 404 error. If I try and pass only the printer ip as url ( instead of http://ipAddress:631/printers, I am getting 406 error( not accessible error). Could you please guide me what the issue could be.

Sandeep

Imprimante partagée par la livebox

Bonjour,

Tout d'abord merci pour cette application sous licence libre.
Je m'exprime en français, merci de me dire s'il est préférable de discuter en anglais ici.

J'ai installé mon imprimante Brother en la branchant sur le port usb de ma livebox.

Les deux ordinateurs de la maison y ont accès, sous linux, selon le chemin

ipp14://192.168.1.1/ipp?version=1.0

et cela fonctionne (la config est documentée ici https://doc.ubuntu-fr.org/livebox#livebox_play )

Depuis l'application AndroidCupsPrint, je n'arrive pas à voir l'imprimante par la recherche automatique (cela dit depuis les ordinateurs linux non plus, j'ai dû entrer l'URL à la main).

J'ai tenté de mettre le même chemin, mais cela ne fonctionne pas. Peut-être que la version de CUPS n'est pas la même ? ou autre chose ?

Bref je ne sais pas comment faire reconnaître l'imprimante du coup.

Pouvez-vous m'aider à y voir clair ?

Merci

Notification stays forever

Hi!
I am using ACP with Android 5.1. Printing works, but the printing notification in the status bar stays forever. I have to cancel to get rid of it.

No "Print" option under "Settings"

Hi,

I am trying to use your app on a Samsung Galaxy J5 with Android version 6.0.1 but there is no "Print" option under "Settings".

thanks
AK

Automatic discovery of printers not working

Hi

Thanks for this app. And sorry for the vague title.

I have a wireless printer that has its own server and also this printer shared over a Debian Pc via the Cups server. This app finds the wireless server but no printing happens(tried with firefox page->printing). When I select the printer I see no "print" icon however I have the brothers own print plugin that seem to work.

Also it cant find any Cups printers on the network like the one I mentioned above. I have a Pdf printer that is shared over the network via Cups, that does not show up either. I also tried putting the ip addresses and the printers as I would do over with other pcs, that does not work either.

Lastly The search button does not work when I enter the add printer option. It is not clickable at all. I tried putting custom ip of the server without any suiccess.

thanks

Crashes when choosing cups printer

Hi!
I am using CM12.1. The CM editor cradhes when choosing the cups printer. PDF works. Also the gallery crashes when trying to print images.
Here is the crash report of the editor

java.lang.StringIndexOutOfBoundsException: length=28; regionStart=0; regionLength=-345
    at java.lang.String.startEndAndLength(String.java:504)
    at java.lang.String.substring(String.java:1333)
    at com.cyanogenmod.filemanager.ui.policy.PrintActionPolicy$DocumentAdapter.adjustLines(PrintActionPolicy.java:354)
    at com.cyanogenmod.filemanager.ui.policy.PrintActionPolicy$DocumentAdapter.onLayout(PrintActionPolicy.java:272)
    at android.print.PrintManager$PrintDocumentAdapterDelegate$MyHandler.handleMessage(PrintManager.java:771)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5294)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

java.lang.IllegalStateException: No media size specified.

I have the following issue: The printer is detected, but it is "currently not available". The logcat shows the following two entries:

09-20 20:25:59.294  8039 26272 I CUPS    : Checking printer status: PrinterId{serviceName=io.github.benoitduffez.cupsprint/io.github.benoitduffez.cupsprint.printservice.CupsService, localId=http://192.168.42.9:631/printers/HP_LaserJet_6MP}
09-20 20:25:59.377  8039 26272 E CUPS    : Failed to check printer PrinterId{serviceName=io.github.benoitduffez.cupsprint/io.github.benoitduffez.cupsprint.printservice.CupsService, localId=http://192.168.42.9:631/printers/HP_LaserJet_6MP}: java.lang.IllegalStateException: No media size specified.

In the CUPS webinterface the defaults are shown as follows:
Defaults: job-sheets=none, none media=iso_a4_210x297mm sides=one-sided

Not working on Huawei Y360-U31

Huawei Y360-U31
Android 4.4.2
German language

Installed, but do not see a "Printing" or "Drucken" item in the Settings (All) menu.
Also do not see an icon.
But it does show in the Apps list.

86acef4 seems to make application crash on mdns query

Building/assembling works but when querying for printers the app crashes.

Workaround: Resurrect JfSSLScheme.java class and add

android {
    useLibrary 'org.apache.http.legacy'
    ...

in app/build.gradle.

But I guess the workaround is not the outcome you were aiming at...

V/WindowManager(10292): not Base app: Adding window Window{38b0d0bc u0 com.android.settings/com.android.settings.SubSettings} at 7 of 13
D/mali_winsys(14025): new_window_surface returns 0x3000
I/ActivityManager(10292): Start proc 14212:io.github.benoitduffez.cupsprint/u0a123 for service io.github.benoitduffez.cupsprint/.printservice.CupsService
W/InputMethodManagerService(10292): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@8284afd attribute=null, token = android.os.BinderProxy@34f08124
E/AndroidRuntime(14212): FATAL EXCEPTION: AsyncTask #1
E/AndroidRuntime(14212): Process: io.github.benoitduffez.cupsprint, PID: 14212
E/AndroidRuntime(14212): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(14212):    at android.os.AsyncTask$3.done(AsyncTask.java:304)
E/AndroidRuntime(14212):    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime(14212):    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime(14212):    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime(14212):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/AndroidRuntime(14212):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(14212):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(14212):    at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime(14212): Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/jonbanjo/ssl/JfSSLScheme;
E/AndroidRuntime(14212):    at org.cups4j.operations.IppOperation.sendRequest(IppOperation.java:212)
E/AndroidRuntime(14212):    at org.cups4j.operations.IppOperation.sendRequest(IppOperation.java:140)
E/AndroidRuntime(14212):    at org.cups4j.operations.IppOperation.request(IppOperation.java:75)
E/AndroidRuntime(14212):    at org.cups4j.operations.cups.CupsGetPrintersOperation.getPrinters(CupsGetPrintersOperation.java:51)
E/AndroidRuntime(14212):    at org.cups4j.CupsClient.getPrinters(CupsClient.java:76)
E/AndroidRuntime(14212):    at org.cups4j.CupsClient.getPrinter(CupsClient.java:96)
E/AndroidRuntime(14212):    at com.jonbanjo.detect.MdnsServices.scan(MdnsServices.java:236)
E/AndroidRuntime(14212):    at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession.scanPrinters(CupsPrinterDiscoverySession.java:250)
E/AndroidRuntime(14212):    at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession.access$000(CupsPrinterDiscoverySession.java:63)
E/AndroidRuntime(14212):    at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession$1.doInBackground(CupsPrinterDiscoverySession.java:83)
E/AndroidRuntime(14212):    at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession$1.doInBackground(CupsPrinterDiscoverySession.java:80)
E/AndroidRuntime(14212):    at android.os.AsyncTask$2.call(AsyncTask.java:292)
E/AndroidRuntime(14212):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime(14212):    ... 4 more
E/AndroidRuntime(14212): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.jonbanjo.ssl.JfSSLScheme" on path: DexPathList[[zip file "/data/app/io.github.benoitduffez.cupsprint-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
E/AndroidRuntime(14212):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(14212):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime(14212):    at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime(14212):    ... 17 more
E/AndroidRuntime(14212):    Suppressed: java.lang.ClassNotFoundException: com.jonbanjo.ssl.JfSSLScheme
E/AndroidRuntime(14212):        at java.lang.Class.classForName(Native Method)
E/AndroidRuntime(14212):        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime(14212):        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime(14212):        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime(14212):        ... 18 more
E/AndroidRuntime(14212):    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

It doesn't work with Samsung SCX-3400 + Archlinux + CM13

From my Android (CM13), the printer (SCX-3400) is detected but when I want to print, I have this error:

Can't create handler inside thread that has not called Looper.prepare()

Then This printer is not available.

The printer is not wired to the computer with a USB cable, it's on the local network with Wifi.

Hostname not verifed

I don't know if this is an SSL issue or a reverse DNS issue. I can print over WiFi from another unix box and I don't get anything like this. As far as I know I'm not running SSL at all (no reason to). Reverse DNS, well, I have my HP printer plugged into (USB) a Raspberry Pi, which connects by WiFi to an Android phone's WiFi hotspot. The phone's in control of DNS and DHCP.

Your app is apparently trying to do something unnecessary and it doesn't work. I'm not sure what.
It's the version that's currently (April 7) on Google Play.

screenshot_2017-04-07-11-21-28

I'm also at [email protected], just happened to have a github account and be on a CUPS mailing list.

Add IPv6 support

Seems to break things:

1	|	13:48:48:985	|	D/CrashlyticsCore Failed to check printer PrinterId{serviceName=io.github.benoitduffez.cupsprint/io.github.benoitduffez.cupsprint.printservice.CupsService, localId=http://[fe80::da9d:XXXX:XXXX:XXXX]:631/printers/printer}
2	|	13:48:48:986	|	D/CrashlyticsCore HTTP response code: 0

Exception:

Non-fatal Exception: java.net.MalformedURLException: java.lang.IllegalArgumentException: invalid port: -1
       at java.net.URL.<init>(URL.java:190)
       at java.net.URL.<init>(URL.java:125)
       at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession.checkPrinter(CupsPrinterDiscoverySession.java:163)
       at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession.access$200(CupsPrinterDiscoverySession.java:80)
       at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession$2.doInBackground(CupsPrinterDiscoverySession.java:372)
       at io.github.benoitduffez.cupsprint.printservice.CupsPrinterDiscoverySession$2.doInBackground(CupsPrinterDiscoverySession.java:365)
       at android.os.AsyncTask$2.call(AsyncTask.java:295)
       at java.util.concurrent.FutureTask.run(FutureTask.java:237)
       at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
       at java.lang.Thread.run(Thread.java:818)

Min API level

Hello Benoît, and thanks for taking over maintenance of this application!

Is there any chance that the minimum API level could be lowered to 17, so as to support Android 4.2.1?

Non-stop Searching for printers

Turn on service, answer "OK" to security question. Device then starts "Searching for printers" - if there are no appropriate servers on the network, it will search forever. Using the Menu button, add a printer using the format shown, e.g. "http://192.168.1.111:631/printers/hp_thinkjet" (I copied and pasted the text from my working CUPS device). Select "Add printer" and return to the still-searching screen. The printer is not added.

SUGGESTIONS:

  1. Add a "Stop" button to the search screen, to allow the service to continue running without searching for new devices.
  2. Make the (manual) "Add Printer" function work, whether or not the service is searching for new devices.

Using a free crash reporting solution or add free flavour

Hello, F-Droid packager here.

F-Droid logo
F-Droid is an Android app store exclusively for open source apps. See F-Droid's Wikipedia page.
You can browse the catalog of available apps on Fossdroid.

I want to update the newest version of the app for F-Droid, and I've seen that you recently added crashlytics, which is a proprietary library. F-Droid forbids proprietary libraries.

It would be really great if you could provide either a custom gradle flavour that doesn't use crashlytics, or use a free alternative to crashlytics like acra.

Thanks for your help!

Support for setup that requires login and password?

Hey, I just downloaded your app from Play Store and I'd like to ask (if answer is 'No' I'd also like to ask for such a feature/support) if CupsPrint support passworded printers?
I enabled remote access to my CUPS server (in order to for example restart printer remotely or fix something in cups when I'm not at home) but I put a login requirement since I do not like people looking/messing in my stuff. So the conf is looking like this:

<Location />
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
  Allow all
</Location>

As far as I see CupsPrint do not understand(do not add printer at all)

http://login:password@ip:port/printers/myprinter

but it works when I leave cups webpage unprotected(which I dont like)

IPP printing

On my Linux PC cups uses Device URI: ipp://192.168.1.22/ipp
If I enter the same URI in Android CUPS Print, the printer is added, but when I try to print it says "Printer is not responding".

Uniform Coding Style

For a better maintenance and to make it easier for contributors it would be useful to have a uniform coding style. There is a mix between Jon Freemans code and yours. I have no specific preference as long as it is a consistent style.

Uniform License

There is a mix between LGPL v2.1 and LGPL v3. Do you mind relicensing the LGPL v2.1 parts to LGPL v3? (Benefit: Single file header, lesser files: COPYING.v2.1 and COPYING.LESSER.v2.1 can be omitted)

No TLS encryption

Hello,

I am trying to use AndroidCupsPrint on a Samsung Galaxy J5 with Android 6.0.1. Unfortunately I can not print at all.

Bellow you can see the error from CUPS error.log

E [28/Jan/2017:10:11:17 +0200] Unable to encrypt connection from 192.168.1.54 - A TLS fatal alert has been received.
E [28/Jan/2017:10:16:28 +0200] [Client 25] Returning IPP client-error-bad-request for Print-Job (https://192.168.1.2/printers/Deskjet_2640) from 192.168.1.54

This is on a Debian 8.7 with cups 1.7.5

Thanks
AK

Doesn't show all printers on a server

I have a setup where I have ten printers plugged into a single CUPS instance. However, only two of them show up when the AndroidCUPSPrint plugin searches for local printers.

This is with the current 1.3.1 release (obtained via f-droid), running on CM12.1 (Android 5.1.1) talking to a CUPS 2.2.0 server. All printers are exported/shared, and Linux desktops see them.

Why ten printers, you may ask? I write printer drivers (Gutenprint) for fun and occasional profit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.