DACCe
DACCe (Auxiliary Document of the Electronic Correction Letter) is a printed representation of the CC-e (Electronic Correction Letter) used in Brazil. It provides details about corrections made to a previously issued NF-e (Electronic Invoice), including the correction text, the referenced invoice key, and protocol information.
Basic Usage
from brazilfiscalreport.dacce import DaCCe
# Path to the XML file
xml_file_path = 'cce.xml'
# Load XML Content
with open(xml_file_path, "r", encoding="utf8") as file:
xml_content = file.read()
# Instantiate the CC-e PDF object with the loaded XML content
cce = DaCCe(xml=xml_content)
# Save the generated PDF to a file
cce.output('cce.pdf')
Customizing DACCe 🎨
The DaCCe class accepts the following parameters:
Parameters
xml
- Type:
str - Description: The XML content of the CC-e event.
- Required: Yes.
emitente
- Type:
dictorNone - Description: A dictionary containing the issuer (emitente) information. When provided, the issuer details are displayed in the header of the DACCe.
- Keys:
nome,end,bairro,cidade,uf,fone - Example:
- Default:
None(no issuer info displayed).
image
- Type:
str,BytesIO,bytes, orNone - Description: Path to a logo image file or binary image data to be displayed in the header alongside the issuer information.
- Example:
- Default:
None(no logo).
Usage Example with Customization
from brazilfiscalreport.dacce import DaCCe
# Path to the XML file
xml_file_path = 'cce.xml'
# Load XML Content
with open(xml_file_path, "r", encoding="utf8") as file:
xml_content = file.read()
# Issuer information
emitente = {
"nome": "EMPRESA LTDA",
"end": "AV. TEST, 100",
"bairro": "CENTRO",
"cidade": "SÃO PAULO",
"uf": "SP",
"fone": "(11) 1234-5678",
}
# Instantiate with issuer and logo
cce = DaCCe(xml=xml_content, emitente=emitente, image="path/to/logo.png")
# Save the generated PDF to a file
cce.output('cce.pdf')