Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use hplip for android

I want to use "hplip" for printing from android device. Please tell me how can I build "hplip" and use in android. Is there are any wrapper available for android?

See hplip documentation here

like image 445
Parveen Avatar asked Dec 21 '25 06:12

Parveen


1 Answers

You can static build "hpijs" that is part of "hplib" and Ghostscript, it can run on Android. print command like this:

gs -sDEVICE=ijs -sIjsServer=hpijs -dIjsUseOutputFD -sDeviceManufacturer="HEWLETT-PACKARD" -sDeviceModel="deskjet 5550" -r300x300 -dNOPAUSE -dSAFER -sOutputFile="/dev/usb/lp0" ruler.pdf -c quit

PS: long long ago "hpijs" is single, so you can get old version. here is a shell to build hpijs.(The comments of shell is Mother tongue, you can use Google Translate :) )

#!/bin/sh
# 说明:本脚本是交叉(ARM)编译hpijs-2.1.4

DESTDIR=${PWD}/_install
# 1.下载源码 项目地址:http://sourceforge.net/projects/hpinkjet/files/
wget http://superb-dca2.dl.sourceforge.net/project/hpinkjet/hpijs/2.1.4/hpijs-2.1.4.tar.gz &&

# 2.解压源码
tar xvzf hpijs-2.1.4.tar.gz && cd hpijs-2.1.4 &&

# 3.配置 说明:CXXFLAGS默认是"-g -O2",这里添加-static以静态编译hpijs
./configure --host=arm-linux --target=arm-linux --build=i686-linux CC=arm-linux-gcc CXX=arm-linux-g++ LD=arm-linux-ld RANLIB=arm-linux-ranlib AR=arm-linux-ar CXXFLAGS="-static -g -O2" --prefix=/ LDFLAGS=-L../jpeg-8b/.libs &&

# 4.修正语法错误 dj3320.cpp第403行和registry.cpp第249行 开头的char改为const char
sed -i '249s/\tchar\t/\tconst char\t/' registry.cpp &&
sed -i '403s/  char/  const char/' dj3320.cpp &&

# 5.编译并安装
make && make install DESTDIR=$DESTDIR

# 6.hpijs支持的打印机型号:hpijs-2.1.4/ppd查看.
#    MDL MFG名字都在ppd文件中.
like image 101
kangear Avatar answered Dec 22 '25 19:12

kangear



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!