Search in sources :

Example 1 with SocketPrintHandler

use of org.openmrs.module.printer.handler.SocketPrintHandler in project openmrs-module-pihcore by PIH.

the class ZplLabLabelTemplateTest method shouldPrintToPrinter.

@Test
// just used to print against a test printer when one is on the network
@Ignore
public void shouldPrintToPrinter() throws Exception {
    Patient patient = new Patient();
    PersonName name = new PersonName();
    name.setGivenName("Mark");
    name.setFamilyName("Goodrich");
    patient.addName(name);
    PatientIdentifier patientIdentifier = new PatientIdentifier();
    patientIdentifier.setIdentifier("YXB123");
    patientIdentifier.setIdentifierType(primaryIdentifierType);
    patient.addIdentifier(patientIdentifier);
    String data = template.generateLabel(patient);
    Printer printer = new Printer();
    printer.setIpAddress("10.10.216.207");
    printer.setPort("9100");
    printer.setId(1);
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("data", data);
    paramMap.put("encoding", "UTF-8");
    new PrinterServiceImpl().print(paramMap, printer, false, new SocketPrintHandler());
}
Also used : PersonName(org.openmrs.PersonName) HashMap(java.util.HashMap) Patient(org.openmrs.Patient) Printer(org.openmrs.module.printer.Printer) PrinterServiceImpl(org.openmrs.module.printer.PrinterServiceImpl) PatientIdentifier(org.openmrs.PatientIdentifier) SocketPrintHandler(org.openmrs.module.printer.handler.SocketPrintHandler) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 Patient (org.openmrs.Patient)1 PatientIdentifier (org.openmrs.PatientIdentifier)1 PersonName (org.openmrs.PersonName)1 Printer (org.openmrs.module.printer.Printer)1 PrinterServiceImpl (org.openmrs.module.printer.PrinterServiceImpl)1 SocketPrintHandler (org.openmrs.module.printer.handler.SocketPrintHandler)1