etiquetador-correios
v0.0.4
Published
Gerador de etiquetas para encomendas do correios
Downloads
11
Readme
etiquetador-correios
Gerador completamento dinamico de etiquetas do Correios, nesse projeto buscamos mimicar exatamente o mesmo PDF que a API do correios produz utilizando-se de duas bibliotecas:
- PDFKit para a producao de PDFs
- BwipJs para codigo de barras e QR Code
Etiqueta original do correios
Modelamos nossa etiqueta em cima da etiqueta oficial deles
Screenshot da nossa etiqueta
Aqui podemos ver o que geramos com BwipJs e PDFKit
Desenvolvimento:
Como rodar?
npm install etiquetador-correios
Exemplo de uso
import fs from 'fs';
import { gerarBase64 } from '.';
const remetente = {
address: {
NomeLinha1: 'NomeLinha1',
NomeLinha2: 'NomeLinha2',
RuaComPrefixo: 'RuaComPrefixo',
NumeroDaRua: 123,
Complemento: 'Complemento',
Bairro: 'Bairro',
CEP: 'CEP',
Cidade: 'Cidade',
Estado: 'SP',
},
};
const destinatario = {
address: {
NomeLinha1: 'NomeLinha1',
NomeLinha2: 'NomeLinha2',
RuaComPrefixo: 'RuaComPrefixo',
NumeroDaRua: 123,
Complemento: 'Complemento',
Bairro: 'Bairro',
CEP: 'CEP',
Cidade: 'Cidade',
Estado: 'SP',
},
};
const base64 : string = gerarBase64(remetente, destinatario);
fs.writeFileSync('rotulo.pdf', base64, 'base64');