Spaces:
Sleeping
Sleeping
Commit
路
08e8516
1
Parent(s):
4789a30
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,11 +12,11 @@ def convert_zpl_to_pdf(zpl_string):
|
|
| 12 |
response = requests.post(labelary_api, headers=headers, data=zpl_string.encode('utf-8'), stream=True)
|
| 13 |
|
| 14 |
if response.status_code == 200:
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
else:
|
| 21 |
raise Exception(f"Error durante la conversi贸n de ZPL a PDF: {response.text}")
|
| 22 |
|
|
|
|
| 12 |
response = requests.post(labelary_api, headers=headers, data=zpl_string.encode('utf-8'), stream=True)
|
| 13 |
|
| 14 |
if response.status_code == 200:
|
| 15 |
+
# Creamos un archivo temporal y escribimos el contenido del PDF
|
| 16 |
+
fd, path = tempfile.mkstemp(suffix='.pdf')
|
| 17 |
+
with os.fdopen(fd, 'wb') as tmp:
|
| 18 |
+
tmp.write(response.content)
|
| 19 |
+
return path
|
| 20 |
else:
|
| 21 |
raise Exception(f"Error durante la conversi贸n de ZPL a PDF: {response.text}")
|
| 22 |
|