We have a POS written in PHP which needs to interact with a POS printer. The printer support JavaPOS. The state of PHP POS is that it generates a bill and waits for a user to select a printer.
The issue now is, the JavaPOS printer doesn't show up. I am able to interact with using test Java code which has the necessary drivers & jpos.xml. I wish to 'install' this.
From my understanding for past four days going through JavaPOS manuals from different manufactures [EPSON, Starmicronics, Diebold Nixdorfag ], it is not possible. JavaPOS is meant for POS system written in Java [JavaFX to Spring].
But I find it very odd to believe this. I believe this shouldn't be the case because if this true, it would make very hard for POS not written in Java or .Net to interact with plethora of POS devices and terminal out there.
Hence, is it possible to interact with non Java & non .Net POS to send print command to JavaPOS device?
Please note, simply installing the device and sending a print command doesn't fix the issue. Say, if I want to add a logo to the receipt along with dynamic data in the footer of the receipt, Java code will be required for .Net to make it 'rich'. Now, where does this Java code specifically sit? Is it some virtual device which runs in the background and pretends to be a printer and shows up in the print dialog in a, say PHP POS?
Sample Java code written to interact with JavaPOS with jpos.xml file as reference.
public static void main(String[] args) {
File f = new File(PrintFTest.class.getClassLoader().getResource("jpos.xml").getPath());
System.setProperty(JposPropertiesConst.JPOS_POPULATOR_FILE_PROP_NAME, f.getAbsolutePath());
//System.getProperties().list(System.out);
FiscalPrinter fiscalPrinter = new FiscalPrinter();
// Get Access to it
try {
fiscalPrinter.open("printf");
fiscalPrinter.claim(1000);
fiscalPrinter.setDeviceEnabled(true);
} catch (JposException e) {
System.out.println("Exception at Access");
e.printStackTrace();
}
// Print
try {
fiscalPrinter.resetPrinter();
fiscalPrinter.beginFiscalReceipt(true);
fiscalPrinter.printRecItem("Salame", 40000, 0, 0, 0, "");
fiscalPrinter.printRecTotal(40000, 40000, "CONTANTI");
fiscalPrinter.endFiscalReceipt(false);
} catch (JposException e) {
System.out.println("Exception at Print");
}
try {
System.out.println("1FP - Fiscal Printer disabling");
fiscalPrinter.setDeviceEnabled(false);
System.out.println("2FP - Fiscal Printer releasing");
fiscalPrinter.release();
System.out.println("2FP - Fiscal Printer closing");
fiscalPrinter.close();
} catch (JposException e) {
System.out.println("Exception at Close");
}
}
}