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());
}
Aggregations