public TextoSimples(Estilo estilo, String texto) : base(estilo) { Texto = texto; AlinhamentoHorizontal = AlinhamentoHorizontal.Esquerda; AlinhamentoVertical = AlinhamentoVertical.Topo; TamanhoFonte = 6; }
internal T AdicionarBloco <T>(Estilo estilo) where T : BlocoBase { var bloco = CriarBloco <T>(estilo); _Blocos.Add(bloco); return(bloco); }
public Campo(String cabecalho, String conteudo, Estilo estilo, AlinhamentoHorizontal alinhamentoHorizontalConteudo = AlinhamentoHorizontal.Esquerda) : base(estilo) { Cabecalho = cabecalho; this.Conteudo = conteudo; AlinhamentoHorizontalConteudo = alinhamentoHorizontalConteudo; IsConteudoNegrito = true; Height = Constantes.CampoAltura; }
public override void Draw(Gfx gfx) { base.Draw(gfx); // 7.7.6 Conteúdo do Quadro Dados do Emitente // Deverá estar impresso em negrito.A razão social e/ ou nome fantasia deverá ter tamanho // mínimo de doze(12) pontos, ou 17 CPP e os demais dados do emitente, endereço, // município, CEP, fone / fax deverão ter tamanho mínimo de oito(8) pontos, ou 17 CPP. var rp = BoundingBox.InflatedRetangle(0.75F); float alturaMaximaLogoHorizontal = 14F; Fonte f2 = Estilo.CriarFonteNegrito(12); Fonte f3 = Estilo.CriarFonteRegular(8); if (Logo == null) { var f1 = Estilo.CriarFonteRegular(6); gfx.DrawString("IDENTIFICAÇÃO DO EMITENTE", rp, f1, AlinhamentoHorizontal.Centro); rp = rp.CutTop(f1.AlturaLinha); } else { RectangleF rLogo; if (Logo.Size.Width >= Logo.Size.Height) { rLogo = new RectangleF(rp.X, rp.Y, rp.Width, alturaMaximaLogoHorizontal); rp = rp.CutTop(alturaMaximaLogoHorizontal); } else { float lw = rp.Height * Logo.Size.Width / Logo.Size.Height; rLogo = new RectangleF(rp.X, rp.Y, lw, rp.Height); rp = rp.CutLeft(lw); } gfx.ShowXObject(Logo, rLogo); } var emitente = ViewModel.Emitente; var nome = !String.IsNullOrWhiteSpace(emitente.NomeFantasia) ? emitente.NomeFantasia : emitente.RazaoSocial; var ts = new TextStack(rp) { LineHeightScale = 1 } .AddLine(nome, f2) .AddLine(emitente.EnderecoLinha1.Trim(), f3) .AddLine(emitente.EnderecoLinha2.Trim(), f3) .AddLine(emitente.EnderecoLinha3.Trim(), f3); ts.AlinhamentoHorizontal = AlinhamentoHorizontal.Centro; ts.AlinhamentoVertical = AlinhamentoVertical.Centro; ts.Draw(gfx); }
public Tabela(Estilo estilo) : base(estilo) { Colunas = new List <TabelaColuna>(); Linhas = new List <List <string> >(); LinhaAtual = 0; TamanhoFonteCabecalho = 6; PaddingHorizontal = 0.6F; PaddingSuperior = 0.75F; PaddingInferior = 0.3F; // 7.7.7 Conteúdo dos Campos do Quadro “Dados dos Produtos/Serviços” // Deverá ter tamanho mínimo de seis(6) pontos, ou 17 CPP. FonteCorpo = estilo.CriarFonteRegular(6F); FonteCabecalho = estilo.CriarFonteRegular(6F); }
public Barcode128C(String code, Estilo estilo, float largura = 75F) : base(estilo) { if (String.IsNullOrWhiteSpace(code)) { throw new ArgumentException("O código não pode ser vazio.", "code"); } if (!Regex.IsMatch(code, @"^\d+$")) { throw new ArgumentException("O código deve apenas conter digítos numéricos.", "code"); } if (code.Length % 2 != 0) { Code = "0" + code; } else { Code = code; } Largura = largura; }
public override void Draw(Gfx gfx) { base.Draw(gfx); if (!String.IsNullOrWhiteSpace(Texto)) { var r = BoundingBox.InflatedRetangle(0.75F); var tb = new TextBlock(Texto, Estilo.CriarFonteRegular(TamanhoFonte)); tb.AlinhamentoHorizontal = AlinhamentoHorizontal; tb.Width = r.Width; var y = r.Y; if (AlinhamentoVertical == AlinhamentoVertical.Centro) { y += (r.Height - tb.Height) / 2F; } tb.SetPosition(r.X, y); tb.Draw(gfx); } }
public override void Draw(Gfx gfx) { base.Draw(gfx); var r = BoundingBox.InflatedRetangle(1); var f1 = Estilo.CriarFonteNegrito(14); var f2 = Estilo.CriarFonteNegrito(11F); gfx.DrawString("NF-e", r, f1, AlinhamentoHorizontal.Centro); r = r.CutTop(f1.AlturaLinha); TextStack ts = new TextStack(r) { AlinhamentoHorizontal = AlinhamentoHorizontal.Centro, AlinhamentoVertical = AlinhamentoVertical.Centro, LineHeightScale = 1F } .AddLine($"Nº.: {NfNumero}", f2) .AddLine($"Série: {NfSerie}", f2); ts.Draw(gfx); }
public DanfeNFC(DanfeViewModel viewModel, string creditos = null, string metadataCriador = null) { ViewModel = viewModel ?? throw new ArgumentNullException(nameof(viewModel)); File = new File(); PdfDocument = File.Document; if (viewModel.Produtos.Count <= 20) { _size = new SizeF(280, viewModel.Produtos.Count * 30 + 600); } else if (viewModel.Produtos.Count <= 40) { _size = new SizeF(280, viewModel.Produtos.Count * 14 + 600); } else if (viewModel.Produtos.Count <= 75) { _size = new SizeF(280, viewModel.Produtos.Count * 12 + 600); } else if (viewModel.Produtos.Count <= 150) { _size = new SizeF(280, viewModel.Produtos.Count * 11 + 600); } else if (viewModel.Produtos.Count <= 250) { _size = new SizeF(280, viewModel.Produtos.Count * 10.5F + 600); } else if (viewModel.Produtos.Count <= 400) { _size = new SizeF(280, viewModel.Produtos.Count * 10.2F + 600); } else if (viewModel.Produtos.Count <= 480) { _size = new SizeF(280, viewModel.Produtos.Count * 10.1F + 600); } else if (viewModel.Produtos.Count <= 700) { _size = new SizeF(280, viewModel.Produtos.Count * 9.8F + 600); } // 1. Add the page to the document! _page = new Page(PdfDocument, _size); // Instantiates the page inside the document context. PdfDocument.Pages.Add(_page); // Puts the page in the pages collection. // 2. Create a content composer for the page! _primitiveComposer = new PrimitiveComposer(_page); _creditos = creditos ?? "Impresso com DanfeSharp"; _metadataCriador = metadataCriador ?? String.Format("{0} {1} - {2}", "DanfeSharp", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version, "https://github.com/SilverCard/DanfeSharp"); // De acordo com o item 7.7, a fonte deve ser Times New Roman ou Courier New. _FonteFamilia = StandardType1Font.FamilyEnum.Helvetica; _FonteRegular = new StandardType1Font(PdfDocument, _FonteFamilia, false, false); _FonteNegrito = new StandardType1Font(PdfDocument, _FonteFamilia, true, false); _FonteItalico = new StandardType1Font(PdfDocument, _FonteFamilia, false, true); EstiloPadrao = CriarEstilo(); AdicionarMetadata(); _FoiGerado = false; }
internal T CriarBloco <T>(Estilo estilo) where T : BlocoBase { return((T)Activator.CreateInstance(typeof(T), ViewModel, estilo)); }
public Duplicata(Estilo estilo, DuplicataViewModel viewModel) : base(estilo) { ViewModel = viewModel; FonteA = estilo.CriarFonteRegular(7.5F); FonteB = estilo.CriarFonteNegrito(7.5F); }
public IdentificacaoEmitente(Estilo estilo, DanfeViewModel viewModel) : base(estilo) { ViewModel = viewModel; Logo = null; }
public override void Draw(Gfx gfx) { base.Draw(gfx); // 7.7.4 Conteúdo do Bloco de Campos de Identificação do Documento // O conteúdo dos campos “DANFE”, “entrada ou saída”, “número”, “série” e “folhas do // documento” deverá ser impresso em caixa alta(maiúsculas). Além disto: // a descrição “DANFE” deverá estar impressa em negrito e ter tamanho mínimo de // doze(12) pontos, ou 10 CPP; // // a série e número da NF-e, o número de ordem da folha, o total de folhas do // DANFE e o número identificador do tipo de operação(se “ENTRADA” ou // “SAÍDA”, conforme tag “tpNF”) deverão estar impressos em negrito e ter // tamanho mínimo de dez(10) pontos, ou 10 CPP; // // a identificação “DOCUMENTO AUXILIAR DA NOTA FISCAL ELETRÔNICA” e as // descrições do tipo de operação, “ENTRADA” ou “SAÍDA” deverão ter tamanho // mínimo de oito(8) pontos, ou 17 CPP. float paddingHorizontal = ViewModel.Orientacao == Orientacao.Retrato ? 2.5F : 5F; var rp1 = BoundingBox.InflatedRetangle(1F, 0.5F, paddingHorizontal); var rp2 = rp1; var f1 = Estilo.CriarFonteNegrito(12); var f1h = f1.AlturaLinha; gfx.DrawString("DANFE", rp2, f1, AlinhamentoHorizontal.Centro); rp2 = rp2.CutTop(f1h + 0.5F); var f2 = Estilo.CriarFonteRegular(8F); var f2h = (float)f2.AlturaLinha; var ts = new TextStack(rp2) { AlinhamentoVertical = AlinhamentoVertical.Topo } .AddLine("Documento Auxiliar da", f2) .AddLine("Nota Fiscal Eletrônica", f2); ts.Draw(gfx); rp2 = rp2.CutTop(2F * f2h + 1.5F); ts = new TextStack(rp2) { AlinhamentoVertical = AlinhamentoVertical.Topo, AlinhamentoHorizontal = AlinhamentoHorizontal.Esquerda } .AddLine("0 - ENTRADA", f2) .AddLine("1 - SAÍDA", f2); ts.Draw(gfx); float rectEsSize = 1.75F * f2h; var rectEs = new RectangleF(rp2.Right - rectEsSize, rp2.Y + (2F * f2h - rectEsSize) / 2F, rectEsSize, rectEsSize); gfx.StrokeRectangle(rectEs, 0.25F); gfx.DrawString(ViewModel.TipoNF.ToString(), rectEs, Estilo.FonteNumeroFolhas, AlinhamentoHorizontal.Centro, AlinhamentoVertical.Centro); var f4 = Estilo.FonteNumeroFolhas; var f4h = Estilo.FonteNumeroFolhas.AlturaLinha; rp2.Height = 2F * f4h * TextStack.DefaultLineHeightScale + f2h; rp2.Y = rp1.Bottom - rp2.Height; ts = new TextStack(rp2) { AlinhamentoVertical = AlinhamentoVertical.Topo, AlinhamentoHorizontal = AlinhamentoHorizontal.Centro } .AddLine("Nº.: " + ViewModel.NfNumero.ToString(Formatador.FormatoNumeroNF), f4) .AddLine($"Série: {ViewModel.NfSerie}", f4); ts.Draw(gfx); RetanguloNumeroFolhas = new RectangleF(rp1.Left, rp1.Bottom - Estilo.FonteNumeroFolhas.AlturaLinha, rp1.Width, Estilo.FonteNumeroFolhas.AlturaLinha); }
public NumeroNfSerie2(Estilo estilo, DanfeViewModel viewModel) : base(estilo) { ViewModel = viewModel; }
public CampoMultilinha(String cabecalho, String conteudo, Estilo estilo, AlinhamentoHorizontal alinhamentoHorizontalConteudo = AlinhamentoHorizontal.Esquerda) : base(cabecalho, conteudo, estilo, alinhamentoHorizontalConteudo) { _tbConteudo = new TextBlock(conteudo, estilo.FonteCampoConteudo); IsConteudoNegrito = false; }
public ElementoBase(Estilo estilo) { Estilo = estilo ?? throw new ArgumentNullException(nameof(estilo)); }
public CabecalhoBloco(Estilo estilo, String cabecalho) : base(estilo) { Cabecalho = cabecalho ?? throw new ArgumentNullException(cabecalho); }
public NumeroNfSerie(Estilo estilo, String nfNumero, String nfSerie) : base(estilo) { NfNumero = nfNumero; NfSerie = nfSerie; }