我有 DYMO 无线打印机,我将其设置为静态 IP 地址 10.0.3.7 和子网掩码 255.255.0.0(这是自动的,我不确定是否可以更改)。通过添加 IP 10.0.3.7 并选择 DYMO LabelWriter Wireless 驱动程序,我可以轻松地将这台打印机手动添加到我的 PC。但是,当我尝试通过 Android 的“默认打印服务”连接到我的 Android 设备上的这台打印机时,它说地址 10.0.3.7 处没有打印机。如何正确设置这台打印机,以便我可以通过我的 Android 应用程序连接到它?
我对应用程序的代码没有任何问题,似乎只是连接到打印机。这是我的课:
public class MainActivity extends AppCompatActivity {
Button print;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initializeWidgets();
}
public void initializeWidgets(){
print = (Button) findViewById(R.id.button);
print.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
print();
}
});
}
public void print(){
PrintHelper printHelper = new PrintHelper(this);
printHelper.setScaleMode(PrintHelper.SCALE_MODE_FIT);
Bitmap image = getImage();
if (image != null) {
printHelper.printBitmap("PrintShop", image);
}
}
public Bitmap getImage() {
ImageView imageView = (ImageView) findViewById(R.id.imageView);
Bitmap image = null;
if ((imageView.getDrawable()) != null) {
image = ((BitmapDrawable) imageView.getDrawable()).getBitmap();
}
return image;
}
}
这是 DYMO 提供的设置屏幕截图: