diff --git a/pom.xml b/pom.xml
index f14883eb3..33e5601ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
br.com.rjconsultores
ModelWeb
- 1.85.0
+ 1.86.0
@@ -221,7 +221,13 @@
org.projectlombok
lombok
1.18.32
-
+
+
+
+ com.mashape.unirest
+ unirest-java
+ 1.4.9
+
diff --git a/src/com/rjconsultores/ventaboletos/enums/EnumLinguagemImpresion.java b/src/com/rjconsultores/ventaboletos/enums/EnumLinguagemImpresion.java
index 2a3bc1acf..8ffdbae3e 100644
--- a/src/com/rjconsultores/ventaboletos/enums/EnumLinguagemImpresion.java
+++ b/src/com/rjconsultores/ventaboletos/enums/EnumLinguagemImpresion.java
@@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.enums;
public enum EnumLinguagemImpresion {
HTML(0),
ZPL(1),
+ TEXT(2),
;
private Integer id;
diff --git a/src/com/rjconsultores/ventaboletos/rest/LabelaryService.java b/src/com/rjconsultores/ventaboletos/rest/LabelaryService.java
new file mode 100644
index 000000000..d921089b6
--- /dev/null
+++ b/src/com/rjconsultores/ventaboletos/rest/LabelaryService.java
@@ -0,0 +1,51 @@
+package com.rjconsultores.ventaboletos.rest;
+
+import java.io.InputStream;
+
+import org.apache.http.HttpStatus;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import com.mashape.unirest.http.HttpResponse;
+import com.mashape.unirest.http.Unirest;
+
+public class LabelaryService {
+
+ private static final Logger log = LogManager.getLogger(LabelaryService.class);
+
+ private static LabelaryService instance;
+
+ private String URL = "http://api.labelary.com/v1/printers";
+
+ private LabelaryService() {
+ }
+
+ public static synchronized LabelaryService getInstance() {
+ if (instance == null) {
+ instance = new LabelaryService();
+ }
+ return instance;
+ }
+
+ public InputStream retornarImagem(String texto) {
+
+ try {
+ Unirest.setTimeouts(0, 0);
+ HttpResponse response = Unirest.post(URL + "/8dpmm/labels/4x6/0/>label.png?")
+ .header("Content-Type", "application/x-www-form-urlencoded")
+ .body(texto)
+ .asObject(InputStream.class);
+
+ if (response != null
+ && (response.getStatus() == HttpStatus.SC_OK || response.getStatus() == HttpStatus.SC_CREATED)) {
+ return response.getBody();
+ } else {
+ throw new Exception("erro ao enviar requisicao labelary " + response.getStatusText());
+ }
+ } catch (Exception e) {
+ log.error("erro ao enviar requisicao ", e);
+ }
+ return null;
+ }
+
+}