We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Erro ao imprimir etiquetas (campo descrição estourando)
Nome da Cidade: | Birigui
Estado: | São Paulo
Casa Legislativa: | Câmara Municipal

Bom dia,
Começamos hoje a utilizar a versão 3.1 do SAPL que foi migrado ontem. Mas estamos com um problema na impressão das etiquetas do protocolo administrativo. O problema está na última linha da etiqueta, ela imprimi o Assunto ao invés do Tipo/Número do documento vinculado, gerando uma etiqueta enorme. 
No aguardo,
Evandro.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py`
Content:
```
1 # parameters=sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro
2 
3 """relatorio_protocolo.py
4    External method para gerar o arquivo rml da etiqueta de protocolo
5    Autor: Luciano De Fazio
6    Empresa: OpenLegis Consultoria
7    versÃ£o: 1.0
8 """
9 import time
10 
11 from trml2pdf import parseString
12 
13 
14 def cabecalho(dic_cabecalho, imagem):
15     """Gera o codigo rml do cabecalho"""
16     tmp_data = ''
17     tmp_data += '\t\t\t\t<image x="2.1cm" y="25.7cm" width="59" height="62" file="' + \
18         imagem + '"/>\n'
19     tmp_data += '\t\t\t\t<lines>2cm 25.4cm 19cm 25.4cm</lines>\n'
20     tmp_data += '\t\t\t\t<setFont name="Helvetica-Bold" size="15"/>\n'
21     tmp_data += '\t\t\t\t<drawString x="5cm" y="27.2cm">' + \
22         dic_cabecalho['nom_casa'] + '</drawString>\n'
23     tmp_data += '\t\t\t\t<setFont name="Helvetica" size="12"/>\n'
24     tmp_data += '\t\t\t\t<drawString x="5cm" y="26.6cm">Sistema de Apoio ao Processo Legislativo</drawString>\n'
25     tmp_data += '\t\t\t\t<setFont name="Helvetica-Bold" size="13"/>\n'
26     tmp_data += '\t\t\t\t<drawString x="2.2cm" y="24.6cm">RelatÃ³rio de Controle do Protocolo</drawString>\n'
27 
28     return tmp_data
29 
30 
31 def rodape(lst_rodape):
32     """Gera o codigo rml do rodape"""
33 
34     tmp_data = ''
35     tmp_data += '\t\t\t\t<lines>2cm 3.2cm 19cm 3.2cm</lines>\n'
36     tmp_data += '\t\t\t\t<setFont name="Helvetica" size="8"/>\n'
37     tmp_data += '\t\t\t\t<drawString x="2cm" y="3.3cm">' + \
38         lst_rodape[2] + '</drawString>\n'
39     tmp_data += '\t\t\t\t<drawString x="17.9cm" y="3.3cm">PÃ¡gina <pageNumber/></drawString>\n'
40     tmp_data += '\t\t\t\t<drawCentredString x="10.5cm" y="2.7cm">' + \
41         lst_rodape[0] + '</drawCentredString>\n'
42     tmp_data += '\t\t\t\t<drawCentredString x="10.5cm" y="2.3cm">' + \
43         lst_rodape[1] + '</drawCentredString>\n'
44 
45     return tmp_data
46 
47 
48 def paraStyle():
49     """Gera o codigo rml que define o estilo dos paragrafos"""
50 
51     tmp_data = ''
52     tmp_data += '\t<stylesheet>\n'
53     tmp_data += '\t\t<blockTableStyle id="Standard_Outline">\n'
54     tmp_data += '\t\t\t<blockAlignment value="CENTER"/>\n'
55     tmp_data += '\t\t\t<blockValign value="TOP"/>\n'
56     tmp_data += '\t\t</blockTableStyle>\n'
57     tmp_data += '\t\t<initialize>\n'
58     tmp_data += '\t\t\t<paraStyle name="all" alignment="justify"/>\n'
59     tmp_data += '\t\t</initialize>\n'
60     tmp_data += '\t\t<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="5.0" leading="6" alignment="CENTER"/>\n'
61     tmp_data += '\t\t<paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="9" alignment="CENTER"/>\n'
62     tmp_data += '\t</stylesheet>\n'
63 
64     return tmp_data
65 
66 
67 def protocolos(lst_protocolos, dic_cabecalho):
68     """Gera o codigo rml do conteudo da pesquisa de protocolos"""
69 
70     tmp_data = ''
71 
72     # inicio do bloco que contem os flowables
73     tmp_data += '\t<story>\n'
74 
75     for dic in lst_protocolos:
76         # condicao para a quebra de pagina
77         tmp_data += '\t\t<condPageBreak height="8mm"/>\n'
78 
79         # protocolos
80         if dic['titulo'] != None:
81             tmp_data += '\t\t<para style="P1">\n'
82             tmp_data += '\t\t\t<font color="white"> </font>\n'
83             tmp_data += '\t\t</para>\n'
84             tmp_data += '\t\t<para style="P2"><b>' + \
85                 dic_cabecalho['nom_casa'] + '</b></para>\n'
86             tmp_data += '\t\t<para style="P2">\n'
87             tmp_data += '\t\t\t<font color="white"> </font>\n'
88             tmp_data += '\t\t</para>\n'
89             tmp_data += '<blockTable style="Standard_Outline"><tr><td>'
90             tmp_data += '<barCode code="Code128" x="0.15cm" barHeight="0.34in" barWidth="0.018in">' + \
91                 dic['titulo'] + '</barCode>\n'
92             tmp_data += '</td></tr></blockTable>'
93             tmp_data += '\t\t<para style="P2"><b>PROTOCOLO GERAL ' + \
94                 dic['titulo'] + '</b></para>\n'
95         if dic['data'] != None:
96             tmp_data += '\t\t<para style="P2"><b>' + \
97                 dic['data'] + '</b></para>\n'
98         tmp_data += '\t\t<para style="P2"><b>' + \
99             dic['natureza']
100         if dic['ident_processo']:
101             tmp_data +=  ' - ' + dic['ident_processo'] + '</b></para>\n'
102         else:
103             tmp_data += '</b></para>\n'
104 
105     tmp_data += '\t</story>\n'
106     return tmp_data
107 
108 
109 def principal(imagem, lst_protocolos, dic_cabecalho, lst_rodape):
110     """Funcao pricipal que gera a estrutura global do arquivo rml"""
111 
112     arquivoPdf = str(int(time.time() * 100)) + ".pdf"
113 
114     tmp_data = ''
115     tmp_data += '<?xml version="1.0" encoding="utf-8" standalone="no" ?>\n'
116     tmp_data += '<!DOCTYPE document SYSTEM "rml_1_0.dtd">\n'
117     tmp_data += '<document filename="etiquetas.pdf">\n'
118     tmp_data += '\t<template pageSize="(62mm, 29mm)" title="Etiquetas de Protocolo" author="Luciano De Fazio" allowSplitting="20">\n'
119     tmp_data += '\t\t<pageTemplate id="first">\n'
120     tmp_data += '\t\t\t<pageGraphics>\n'
121     tmp_data += '\t\t\t<frame id="first" x1="0.03cm" y1="0.1cm" width="61mm" height="29mm"/>\n'
122     tmp_data += '\t\t\t</pageGraphics>\n'
123     tmp_data += '\t\t</pageTemplate>\n'
124     tmp_data += '\t</template>\n'
125     tmp_data += paraStyle()
126     tmp_data += protocolos(lst_protocolos, dic_cabecalho)
127     tmp_data += '</document>\n'
128     tmp_pdf = parseString(tmp_data)
129 
130     return tmp_pdf
131 #     if hasattr(context.temp_folder,arquivoPdf):
132 #         context.temp_folder.manage_delObjects(ids=arquivoPdf)
133 #     context.temp_folder.manage_addFile(arquivoPdf)
134 #     arq=context.temp_folder[arquivoPdf]
135 #     arq.manage_edit(title='Arquivo PDF temporÃ¡rio.',filedata=tmp_pdf,content_type='application/pdf')
136 
137 #     return "/temp_folder/"+arquivoPdf
138 
139 # return
140 # principal(sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro)
141
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py b/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py
--- a/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py
+++ b/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py
@@ -98,7 +98,11 @@
         tmp_data += '\t\t<para style="P2"><b>' + \
             dic['natureza']
         if dic['ident_processo']:
-            tmp_data +=  ' - ' + dic['ident_processo'] + '</b></para>\n'
+            # Limita o tamanho do texto para não "explodir" as etiquetas
+            descricao = dic['ident_processo'][:60]
+            if len(dic['ident_processo']) > 60:
+                descricao += '...'
+            tmp_data += ' - ' + descricao + '</b></para>\n'
         else:
             tmp_data += '</b></para>\n'

{"golden_diff": "diff --git a/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py b/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py\n--- a/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py\n+++ b/sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py\n@@ -98,7 +98,11 @@\n         tmp_data += '\\t\\t<para style=\"P2\"><b>' + \\\n             dic['natureza']\n         if dic['ident_processo']:\n-            tmp_data +=  ' - ' + dic['ident_processo'] + '</b></para>\\n'\n+            # Limita o tamanho do texto para n\u00e3o \"explodir\" as etiquetas\n+            descricao = dic['ident_processo'][:60]\n+            if len(dic['ident_processo']) > 60:\n+                descricao += '...'\n+            tmp_data += ' - ' + descricao + '</b></para>\\n'\n         else:\n             tmp_data += '</b></para>\\n'\n", "issue": "Erro ao imprimir etiquetas (campo descri\u00e7\u00e3o estourando)\nNome da Cidade: | Birigui\r\nEstado: | S\u00e3o Paulo\r\nCasa Legislativa: | C\u00e2mara Municipal\r\n\r\nBom dia,\r\nCome\u00e7amos hoje a utilizar a vers\u00e3o 3.1 do SAPL que foi migrado ontem. Mas estamos com um problema na impress\u00e3o das etiquetas do protocolo administrativo. O problema est\u00e1 na \u00faltima linha da etiqueta, ela imprimi o Assunto ao inv\u00e9s do Tipo/N\u00famero do documento vinculado, gerando uma etiqueta enorme. \r\nNo aguardo,\r\nEvandro.\n", "before_files": [{"content": "# parameters=sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro\n\n\"\"\"relatorio_protocolo.py\n   External method para gerar o arquivo rml da etiqueta de protocolo\n   Autor: Luciano De Fazio\n   Empresa: OpenLegis Consultoria\n   vers\u00c3\u00a3o: 1.0\n\"\"\"\nimport time\n\nfrom trml2pdf import parseString\n\n\ndef cabecalho(dic_cabecalho, imagem):\n    \"\"\"Gera o codigo rml do cabecalho\"\"\"\n    tmp_data = ''\n    tmp_data += '\\t\\t\\t\\t<image x=\"2.1cm\" y=\"25.7cm\" width=\"59\" height=\"62\" file=\"' + \\\n        imagem + '\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<lines>2cm 25.4cm 19cm 25.4cm</lines>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica-Bold\" size=\"15\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"5cm\" y=\"27.2cm\">' + \\\n        dic_cabecalho['nom_casa'] + '</drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica\" size=\"12\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"5cm\" y=\"26.6cm\">Sistema de Apoio ao Processo Legislativo</drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica-Bold\" size=\"13\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"2.2cm\" y=\"24.6cm\">Relat\u00c3\u00b3rio de Controle do Protocolo</drawString>\\n'\n\n    return tmp_data\n\n\ndef rodape(lst_rodape):\n    \"\"\"Gera o codigo rml do rodape\"\"\"\n\n    tmp_data = ''\n    tmp_data += '\\t\\t\\t\\t<lines>2cm 3.2cm 19cm 3.2cm</lines>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica\" size=\"8\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"2cm\" y=\"3.3cm\">' + \\\n        lst_rodape[2] + '</drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"17.9cm\" y=\"3.3cm\">P\u00c3\u00a1gina <pageNumber/></drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawCentredString x=\"10.5cm\" y=\"2.7cm\">' + \\\n        lst_rodape[0] + '</drawCentredString>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawCentredString x=\"10.5cm\" y=\"2.3cm\">' + \\\n        lst_rodape[1] + '</drawCentredString>\\n'\n\n    return tmp_data\n\n\ndef paraStyle():\n    \"\"\"Gera o codigo rml que define o estilo dos paragrafos\"\"\"\n\n    tmp_data = ''\n    tmp_data += '\\t<stylesheet>\\n'\n    tmp_data += '\\t\\t<blockTableStyle id=\"Standard_Outline\">\\n'\n    tmp_data += '\\t\\t\\t<blockAlignment value=\"CENTER\"/>\\n'\n    tmp_data += '\\t\\t\\t<blockValign value=\"TOP\"/>\\n'\n    tmp_data += '\\t\\t</blockTableStyle>\\n'\n    tmp_data += '\\t\\t<initialize>\\n'\n    tmp_data += '\\t\\t\\t<paraStyle name=\"all\" alignment=\"justify\"/>\\n'\n    tmp_data += '\\t\\t</initialize>\\n'\n    tmp_data += '\\t\\t<paraStyle name=\"P1\" fontName=\"Helvetica-Bold\" fontSize=\"5.0\" leading=\"6\" alignment=\"CENTER\"/>\\n'\n    tmp_data += '\\t\\t<paraStyle name=\"P2\" fontName=\"Helvetica\" fontSize=\"8.0\" leading=\"9\" alignment=\"CENTER\"/>\\n'\n    tmp_data += '\\t</stylesheet>\\n'\n\n    return tmp_data\n\n\ndef protocolos(lst_protocolos, dic_cabecalho):\n    \"\"\"Gera o codigo rml do conteudo da pesquisa de protocolos\"\"\"\n\n    tmp_data = ''\n\n    # inicio do bloco que contem os flowables\n    tmp_data += '\\t<story>\\n'\n\n    for dic in lst_protocolos:\n        # condicao para a quebra de pagina\n        tmp_data += '\\t\\t<condPageBreak height=\"8mm\"/>\\n'\n\n        # protocolos\n        if dic['titulo'] != None:\n            tmp_data += '\\t\\t<para style=\"P1\">\\n'\n            tmp_data += '\\t\\t\\t<font color=\"white\"> </font>\\n'\n            tmp_data += '\\t\\t</para>\\n'\n            tmp_data += '\\t\\t<para style=\"P2\"><b>' + \\\n                dic_cabecalho['nom_casa'] + '</b></para>\\n'\n            tmp_data += '\\t\\t<para style=\"P2\">\\n'\n            tmp_data += '\\t\\t\\t<font color=\"white\"> </font>\\n'\n            tmp_data += '\\t\\t</para>\\n'\n            tmp_data += '<blockTable style=\"Standard_Outline\"><tr><td>'\n            tmp_data += '<barCode code=\"Code128\" x=\"0.15cm\" barHeight=\"0.34in\" barWidth=\"0.018in\">' + \\\n                dic['titulo'] + '</barCode>\\n'\n            tmp_data += '</td></tr></blockTable>'\n            tmp_data += '\\t\\t<para style=\"P2\"><b>PROTOCOLO GERAL ' + \\\n                dic['titulo'] + '</b></para>\\n'\n        if dic['data'] != None:\n            tmp_data += '\\t\\t<para style=\"P2\"><b>' + \\\n                dic['data'] + '</b></para>\\n'\n        tmp_data += '\\t\\t<para style=\"P2\"><b>' + \\\n            dic['natureza']\n        if dic['ident_processo']:\n            tmp_data +=  ' - ' + dic['ident_processo'] + '</b></para>\\n'\n        else:\n            tmp_data += '</b></para>\\n'\n\n    tmp_data += '\\t</story>\\n'\n    return tmp_data\n\n\ndef principal(imagem, lst_protocolos, dic_cabecalho, lst_rodape):\n    \"\"\"Funcao pricipal que gera a estrutura global do arquivo rml\"\"\"\n\n    arquivoPdf = str(int(time.time() * 100)) + \".pdf\"\n\n    tmp_data = ''\n    tmp_data += '<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\" ?>\\n'\n    tmp_data += '<!DOCTYPE document SYSTEM \"rml_1_0.dtd\">\\n'\n    tmp_data += '<document filename=\"etiquetas.pdf\">\\n'\n    tmp_data += '\\t<template pageSize=\"(62mm, 29mm)\" title=\"Etiquetas de Protocolo\" author=\"Luciano De Fazio\" allowSplitting=\"20\">\\n'\n    tmp_data += '\\t\\t<pageTemplate id=\"first\">\\n'\n    tmp_data += '\\t\\t\\t<pageGraphics>\\n'\n    tmp_data += '\\t\\t\\t<frame id=\"first\" x1=\"0.03cm\" y1=\"0.1cm\" width=\"61mm\" height=\"29mm\"/>\\n'\n    tmp_data += '\\t\\t\\t</pageGraphics>\\n'\n    tmp_data += '\\t\\t</pageTemplate>\\n'\n    tmp_data += '\\t</template>\\n'\n    tmp_data += paraStyle()\n    tmp_data += protocolos(lst_protocolos, dic_cabecalho)\n    tmp_data += '</document>\\n'\n    tmp_pdf = parseString(tmp_data)\n\n    return tmp_pdf\n#     if hasattr(context.temp_folder,arquivoPdf):\n#         context.temp_folder.manage_delObjects(ids=arquivoPdf)\n#     context.temp_folder.manage_addFile(arquivoPdf)\n#     arq=context.temp_folder[arquivoPdf]\n#     arq.manage_edit(title='Arquivo PDF tempor\u00c3\u00a1rio.',filedata=tmp_pdf,content_type='application/pdf')\n\n#     return \"/temp_folder/\"+arquivoPdf\n\n# return\n# principal(sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro)\n", "path": "sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py"}], "after_files": [{"content": "# parameters=sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro\n\n\"\"\"relatorio_protocolo.py\n   External method para gerar o arquivo rml da etiqueta de protocolo\n   Autor: Luciano De Fazio\n   Empresa: OpenLegis Consultoria\n   vers\u00c3\u00a3o: 1.0\n\"\"\"\nimport time\n\nfrom trml2pdf import parseString\n\n\ndef cabecalho(dic_cabecalho, imagem):\n    \"\"\"Gera o codigo rml do cabecalho\"\"\"\n    tmp_data = ''\n    tmp_data += '\\t\\t\\t\\t<image x=\"2.1cm\" y=\"25.7cm\" width=\"59\" height=\"62\" file=\"' + \\\n        imagem + '\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<lines>2cm 25.4cm 19cm 25.4cm</lines>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica-Bold\" size=\"15\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"5cm\" y=\"27.2cm\">' + \\\n        dic_cabecalho['nom_casa'] + '</drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica\" size=\"12\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"5cm\" y=\"26.6cm\">Sistema de Apoio ao Processo Legislativo</drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica-Bold\" size=\"13\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"2.2cm\" y=\"24.6cm\">Relat\u00c3\u00b3rio de Controle do Protocolo</drawString>\\n'\n\n    return tmp_data\n\n\ndef rodape(lst_rodape):\n    \"\"\"Gera o codigo rml do rodape\"\"\"\n\n    tmp_data = ''\n    tmp_data += '\\t\\t\\t\\t<lines>2cm 3.2cm 19cm 3.2cm</lines>\\n'\n    tmp_data += '\\t\\t\\t\\t<setFont name=\"Helvetica\" size=\"8\"/>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"2cm\" y=\"3.3cm\">' + \\\n        lst_rodape[2] + '</drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawString x=\"17.9cm\" y=\"3.3cm\">P\u00c3\u00a1gina <pageNumber/></drawString>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawCentredString x=\"10.5cm\" y=\"2.7cm\">' + \\\n        lst_rodape[0] + '</drawCentredString>\\n'\n    tmp_data += '\\t\\t\\t\\t<drawCentredString x=\"10.5cm\" y=\"2.3cm\">' + \\\n        lst_rodape[1] + '</drawCentredString>\\n'\n\n    return tmp_data\n\n\ndef paraStyle():\n    \"\"\"Gera o codigo rml que define o estilo dos paragrafos\"\"\"\n\n    tmp_data = ''\n    tmp_data += '\\t<stylesheet>\\n'\n    tmp_data += '\\t\\t<blockTableStyle id=\"Standard_Outline\">\\n'\n    tmp_data += '\\t\\t\\t<blockAlignment value=\"CENTER\"/>\\n'\n    tmp_data += '\\t\\t\\t<blockValign value=\"TOP\"/>\\n'\n    tmp_data += '\\t\\t</blockTableStyle>\\n'\n    tmp_data += '\\t\\t<initialize>\\n'\n    tmp_data += '\\t\\t\\t<paraStyle name=\"all\" alignment=\"justify\"/>\\n'\n    tmp_data += '\\t\\t</initialize>\\n'\n    tmp_data += '\\t\\t<paraStyle name=\"P1\" fontName=\"Helvetica-Bold\" fontSize=\"5.0\" leading=\"6\" alignment=\"CENTER\"/>\\n'\n    tmp_data += '\\t\\t<paraStyle name=\"P2\" fontName=\"Helvetica\" fontSize=\"8.0\" leading=\"9\" alignment=\"CENTER\"/>\\n'\n    tmp_data += '\\t</stylesheet>\\n'\n\n    return tmp_data\n\n\ndef protocolos(lst_protocolos, dic_cabecalho):\n    \"\"\"Gera o codigo rml do conteudo da pesquisa de protocolos\"\"\"\n\n    tmp_data = ''\n\n    # inicio do bloco que contem os flowables\n    tmp_data += '\\t<story>\\n'\n\n    for dic in lst_protocolos:\n        # condicao para a quebra de pagina\n        tmp_data += '\\t\\t<condPageBreak height=\"8mm\"/>\\n'\n\n        # protocolos\n        if dic['titulo'] != None:\n            tmp_data += '\\t\\t<para style=\"P1\">\\n'\n            tmp_data += '\\t\\t\\t<font color=\"white\"> </font>\\n'\n            tmp_data += '\\t\\t</para>\\n'\n            tmp_data += '\\t\\t<para style=\"P2\"><b>' + \\\n                dic_cabecalho['nom_casa'] + '</b></para>\\n'\n            tmp_data += '\\t\\t<para style=\"P2\">\\n'\n            tmp_data += '\\t\\t\\t<font color=\"white\"> </font>\\n'\n            tmp_data += '\\t\\t</para>\\n'\n            tmp_data += '<blockTable style=\"Standard_Outline\"><tr><td>'\n            tmp_data += '<barCode code=\"Code128\" x=\"0.15cm\" barHeight=\"0.34in\" barWidth=\"0.018in\">' + \\\n                dic['titulo'] + '</barCode>\\n'\n            tmp_data += '</td></tr></blockTable>'\n            tmp_data += '\\t\\t<para style=\"P2\"><b>PROTOCOLO GERAL ' + \\\n                dic['titulo'] + '</b></para>\\n'\n        if dic['data'] != None:\n            tmp_data += '\\t\\t<para style=\"P2\"><b>' + \\\n                dic['data'] + '</b></para>\\n'\n        tmp_data += '\\t\\t<para style=\"P2\"><b>' + \\\n            dic['natureza']\n        if dic['ident_processo']:\n            # Limita o tamanho do texto para n\u00e3o \"explodir\" as etiquetas\n            descricao = dic['ident_processo'][:60]\n            if len(dic['ident_processo']) > 60:\n                descricao += '...'\n            tmp_data += ' - ' + descricao + '</b></para>\\n'\n        else:\n            tmp_data += '</b></para>\\n'\n\n    tmp_data += '\\t</story>\\n'\n    return tmp_data\n\n\ndef principal(imagem, lst_protocolos, dic_cabecalho, lst_rodape):\n    \"\"\"Funcao pricipal que gera a estrutura global do arquivo rml\"\"\"\n\n    arquivoPdf = str(int(time.time() * 100)) + \".pdf\"\n\n    tmp_data = ''\n    tmp_data += '<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\" ?>\\n'\n    tmp_data += '<!DOCTYPE document SYSTEM \"rml_1_0.dtd\">\\n'\n    tmp_data += '<document filename=\"etiquetas.pdf\">\\n'\n    tmp_data += '\\t<template pageSize=\"(62mm, 29mm)\" title=\"Etiquetas de Protocolo\" author=\"Luciano De Fazio\" allowSplitting=\"20\">\\n'\n    tmp_data += '\\t\\t<pageTemplate id=\"first\">\\n'\n    tmp_data += '\\t\\t\\t<pageGraphics>\\n'\n    tmp_data += '\\t\\t\\t<frame id=\"first\" x1=\"0.03cm\" y1=\"0.1cm\" width=\"61mm\" height=\"29mm\"/>\\n'\n    tmp_data += '\\t\\t\\t</pageGraphics>\\n'\n    tmp_data += '\\t\\t</pageTemplate>\\n'\n    tmp_data += '\\t</template>\\n'\n    tmp_data += paraStyle()\n    tmp_data += protocolos(lst_protocolos, dic_cabecalho)\n    tmp_data += '</document>\\n'\n    tmp_pdf = parseString(tmp_data)\n\n    return tmp_pdf\n#     if hasattr(context.temp_folder,arquivoPdf):\n#         context.temp_folder.manage_delObjects(ids=arquivoPdf)\n#     context.temp_folder.manage_addFile(arquivoPdf)\n#     arq=context.temp_folder[arquivoPdf]\n#     arq.manage_edit(title='Arquivo PDF tempor\u00c3\u00a1rio.',filedata=tmp_pdf,content_type='application/pdf')\n\n#     return \"/temp_folder/\"+arquivoPdf\n\n# return\n# principal(sessao,imagem,data,lst_protocolos,dic_cabecalho,lst_rodape,dic_filtro)\n", "path": "sapl/relatorios/templates/pdf_etiqueta_protocolo_gerar.py"}]}