|
|
@ -3,6 +3,7 @@ |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
import re |
|
|
import re |
|
|
|
|
|
import os |
|
|
from textwrap import wrap |
|
|
from textwrap import wrap |
|
|
from io import BytesIO |
|
|
from io import BytesIO |
|
|
|
|
|
|
|
|
@ -15,6 +16,8 @@ from reportlab.graphics.shapes import Drawing |
|
|
from reportlab.platypus import Table, TableStyle, Paragraph, Image |
|
|
from reportlab.platypus import Table, TableStyle, Paragraph, Image |
|
|
from reportlab.lib.enums import TA_CENTER |
|
|
from reportlab.lib.enums import TA_CENTER |
|
|
from reportlab.lib.styles import ParagraphStyle |
|
|
from reportlab.lib.styles import ParagraphStyle |
|
|
|
|
|
from reportlab.pdfbase import pdfmetrics |
|
|
|
|
|
from reportlab.pdfbase.ttfonts import TTFont |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def format_cnpj_cpf(value): |
|
|
def format_cnpj_cpf(value): |
|
|
@ -74,6 +77,14 @@ class danfce(object): |
|
|
|
|
|
|
|
|
def __init__(self, list_xml, logo=None, timezone=None): |
|
|
def __init__(self, list_xml, logo=None, timezone=None): |
|
|
|
|
|
|
|
|
|
|
|
path = os.path.join(os.path.dirname(__file__), 'fonts') |
|
|
|
|
|
pdfmetrics.registerFont( |
|
|
|
|
|
TTFont('NimbusSanL-Regu', |
|
|
|
|
|
os.path.join(path, 'NimbusSanL Regular.ttf'))) |
|
|
|
|
|
pdfmetrics.registerFont( |
|
|
|
|
|
TTFont('NimbusSanL-Bold', |
|
|
|
|
|
os.path.join(path, 'NimbusSanL Bold.ttf'))) |
|
|
|
|
|
|
|
|
self.current_font_size = 7 |
|
|
self.current_font_size = 7 |
|
|
self.current_font_name = 'NimbusSanL-Regu' |
|
|
self.current_font_name = 'NimbusSanL-Regu' |
|
|
|
|
|
|
|
|
|