SfeRepGrafica.Core 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SfeRepGrafica.Core --version 2.0.0
                    
NuGet\Install-Package SfeRepGrafica.Core -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SfeRepGrafica.Core" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SfeRepGrafica.Core" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SfeRepGrafica.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SfeRepGrafica.Core --version 2.0.0
                    
#r "nuget: SfeRepGrafica.Core, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SfeRepGrafica.Core@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SfeRepGrafica.Core&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SfeRepGrafica.Core&version=2.0.0
                    
Install as a Cake Tool

SfeRepGrafica

Libreria .NET para la generacion de representaciones graficas (PDF) de facturas electronicas bajo la normativa del Sistema de Facturacion Electronica (SFE) de Bolivia.

Descripcion

SfeRepGrafica genera documentos PDF a partir de datos de facturacion, soportando multiples tipos de documentos fiscales definidos por el SIN (Servicio de Impuestos Nacionales). La libreria implementa el patron Strategy para generar dos formatos de factura:

  • Ejecutiva (Carta): Factura en formato carta estandar (Letter) con cabecera, datos del cliente, detalle de productos, totales, leyendas y codigo QR.
  • POS (Rollo): Factura en formato rollo/ticket para impresoras termicas POS.

Estructura del Proyecto

SfeRepGraficaSolution.sln
├── SfeRepGrafica.Core/          # Libreria principal (NuGet package)
│   ├── Engine/                  # FacturaCreator, DTO, enums
│   ├── Enum/                    # TipoDocumentoSectorEnum (48 tipos de documento)
│   ├── Helpers/                 # FacturaFonts, ITextShapHelper, ImageManager, QR
│   ├── Impresion/               # IImpresionFactura, FacturaEjecutiva, FacturaPos
│   └── Value/                   # Configuracion por tipo de documento fiscal
├── SfeRepGrafica.Client/        # Cliente de prueba (consola)
├── SfeRepGrafica.Api.Test/      # API de prueba
└── SfeRepGrafica.Test/          # Tests unitarios (MSTest)

Requisitos

  • .NET 10.0 SDK
  • Visual Studio 2022+ o VS Code

Instalacion

Como paquete NuGet

El proyecto SfeRepGrafica.Core genera un paquete NuGet al compilar:

dotnet build SfeRepGrafica.Core/SfeRepGrafica.Core.csproj -c Release

El paquete se genera en SfeRepGrafica.Core/bin/Release/SfeRepGrafica.Core.2.0.0.nupkg.

Referencia directa al proyecto

<ProjectReference Include="path/to/SfeRepGrafica.Core/SfeRepGrafica.Core.csproj" />

Uso

using SfeRepGrafica.Core.Engine;
using SfeRepGrafica.Core.Enum;

// Crear el generador
var facturaGenerador = new FacturaCreator();

// Preparar los datos de la factura
var datos = new FacturaRepGrafDto
{
    NombreEmpresa = "Mi Empresa S.R.L.",
    DatosSucursal = "Casa Matriz",
    DatosDetalleSucursal = "Av. Principal #123",
    TipoDocumentoSector = TipoDocumentoSectorEnum.FacturaCompraVenta,
    NitEmisor = "1234567890",
    Autorizacion = "27141900292138",
    NroFactura = 1001,
    NombreCliente = "Juan Perez",
    NitCliente = "9876543",
    Leyenda = "Ley N 453: Puedes presentar tu reclamo...",
    LeyendaTipoNegocio = "CONTRIBUYENTE REGIMEN GENERAL",
    FechaEmision = DateTime.Now,
    Qr = "https://sfe.impuestos.gob.bo/...",
    // ... demas campos
};

// Generar PDF formato Ejecutiva (Carta)
byte[] pdfCarta = facturaGenerador.GenerarRepresentacionGrafica(
    EnumFacturaTipo.EJECUTIVA, datos);

// Generar PDF formato POS (Rollo/Ticket)
byte[] pdfPos = facturaGenerador.GenerarRepresentacionGrafica(
    EnumFacturaTipo.POS, datos);

// Guardar el PDF
File.WriteAllBytes("factura.pdf", pdfCarta);

Merge de multiples PDFs

using SfeRepGrafica.Core.Helpers;

var pdfs = new List<byte[]> { pdf1, pdf2, pdf3 };
byte[] merged = ITextShapHelper.MergePDFs(pdfs);

Generar codigo QR

byte[] qrPng = ITextShapHelper.GenerarQr("datos-para-el-qr");

Tipos de Documento Soportados

La libreria soporta 48 tipos de documentos fiscales definidos en TipoDocumentoSectorEnum, incluyendo:

Tipo Descripcion
FacturaCompraVenta Factura estandar de compra-venta
FacturaComercialExportacion Factura comercial de exportacion
FacturaLibreConsignacion Factura de exportacion en libre consignacion
FacturaMonedaExtranjera Factura en moneda extranjera
FacturaAlcanzadaIce Factura con Impuesto al Consumo Especifico
FacturaSuministroEnergia Factura de suministro de energia electrica
FacturaServicioBasico Factura de servicios basicos
NotaCreditoDebito Nota de credito/debito
... Y 40 tipos mas

Cada tipo de documento tiene su propia configuracion de detalle (columnas, campos, formato) definida en ConfigRepGraficaDetalleValue.

Dependencias

Paquete Version Uso
iTextSharp 5.5.13.5 Generacion de PDF
PDFsharp 6.2.3 Merge de multiples PDFs
QRCoder 1.7.0 Generacion de codigos QR
System.Text.Encoding.CodePages 9.0.0 Soporte de codificaciones

Build y Tests

# Compilar la solucion
dotnet build SfeRepGraficaSolution.sln

# Ejecutar tests
dotnet test SfeRepGrafica.Test/SfeRepGrafica.Test.csproj

Autor

Deyvi Josue Ortiz Vidaurre

Version

2.0.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 111 4/3/2026
2.0.0 126 2/18/2026