Exemplo n.º 1
0
            private StructuralGlyph HandleNewline(StructuralGlyph parent, StyleContext context)
            {
                StructuralGlyph newcontext;

                if (parent is GlyphLine) // normal case
                {
                    if (parent.Parent is VerticalStack)
                    {
                        newcontext = new GlyphLine
                        {
                            Style = context
                        };
                        parent.Parent.Add(newcontext);
                    }
                    else // parent.Parent is not a VerticalStack
                    {
                        var vertStack = new VerticalStack();
                        parent.Parent.Exchange(parent, vertStack);
                        vertStack.Add(parent);
                        newcontext = new GlyphLine
                        {
                            Style = context
                        };
                        vertStack.Add(newcontext);
                    }
                }
                else
                {
                    throw new NotImplementedException();
                }
                return(newcontext);
            }
Exemplo n.º 2
0
        public BlocoCanhoto(DanfeViewModel viewModel, Estilo estilo) : base(viewModel, estilo)
        {
            var textoRecebimento = new TextoSimples(estilo, viewModel.TextoRecebimento)
            {
                Height = TextoRecebimentoAltura, TamanhoFonte = 8
            };
            var nfe = new NumeroNfSerie(estilo, viewModel.NfNumero.ToString(Formatador.FormatoNumeroNF), viewModel.NfSerie.ToString())
            {
                Height = AlturaLinha2 + TextoRecebimentoAltura, Width = 30
            };

            var campos = new LinhaCampos(Estilo)
            {
                Height = AlturaLinha2
            }
            .ComCampo("Data de Recebimento", null)
            .ComCampo("Identificação e assinatura do recebedor", null)
            .ComLarguras(50, 0);

            var coluna1 = new VerticalStack();

            coluna1.Add(textoRecebimento, campos);

            var linha = new FlexibleLine()
            {
                Height = coluna1.Height
            }
            .ComElemento(coluna1)
            .ComElemento(nfe)
            .ComLarguras(0, 16);

            MainVerticalStack.Add(linha, new LinhaTracejada(2));
        }
Exemplo n.º 3
0
        public LinhaCampos AdicionarLinhaCampos()
        {
            var l = new LinhaCampos(Estilo, Width);

            l.Width  = Width;
            l.Height = Constantes.CampoAltura;
            MainVerticalStack.Add(l);
            return(l);
        }
Exemplo n.º 4
0
        public BlocoBase(DanfeViewModel viewModel, Estilo estilo) : base(estilo)
        {
            MainVerticalStack = new VerticalStack();
            ViewModel         = viewModel ?? throw new ArgumentNullException(nameof(viewModel));

            if (!String.IsNullOrWhiteSpace(Cabecalho))
            {
                MainVerticalStack.Add(new CabecalhoBloco(estilo, Cabecalho));
            }
        }
Exemplo n.º 5
0
        public void Stack()
        {
            PdfDocument document = new PdfDocument();
            PdfPage     page     = document.AddPage();

            XGraphics gfx    = XGraphics.FromPdfPage(page);
            Gfx       gfx2   = new Gfx(gfx);
            Estilo    estilo = new Estilo();

            LinhaCampos stack = new LinhaCampos(estilo, 100);

            stack.Height = Constantes.CampoAltura;



            stack.ComCampo("Data", "Data")
            .ComCampo("Recebedor", "Recebedor")
            .ComLarguras(30, 0);


            VerticalStack pilha2 = new VerticalStack();

            pilha2.Width = 100;
            //   pilha2.Height = 2 * Constantes.CampoAltura;

            pilha2.SetPosition(10, 10);

            pilha2.Add(new Campo("Topo", "w", estilo));
            pilha2.Add(stack);

            pilha2.Draw(gfx2);

            pilha2.Y     = pilha2.BoundingBox.Bottom;
            pilha2.Width = 150;
            pilha2.Draw(gfx2);

            pilha2.Y     = pilha2.BoundingBox.Bottom;
            pilha2.Width = 100;
            pilha2.Draw(gfx2);

            document.Save("Pilha.pdf");
        }
        public BlocoIdentificacaoEmitente(DanfeViewModel viewModel, Estilo estilo) : base(viewModel, estilo)
        {
            var textoConsulta = new TextoSimples(Estilo, Strings.TextoConsulta)
            {
                Height = 8,
                AlinhamentoHorizontal = AlinhamentoHorizontal.Centro,
                AlinhamentoVertical   = AlinhamentoVertical.Centro,
                TamanhoFonte          = 9
            };

            var campoChaveAcesso = new Campo("Chave de Acesso", Formatador.FormatarChaveAcesso(ViewModel.ChaveAcesso), estilo, AlinhamentoHorizontal.Centro)
            {
                Height = Constantes.CampoAltura
            };
            var codigoBarras = new Barcode128C(viewModel.ChaveAcesso, Estilo)
            {
                Height = AlturaLinha1 - textoConsulta.Height - campoChaveAcesso.Height
            };

            var coluna3 = new VerticalStack();

            coluna3.Add(codigoBarras, campoChaveAcesso, textoConsulta);

            ifdNfe     = new NumeroNfSerie2(estilo, ViewModel);
            idEmitente = new IdentificacaoEmitente(Estilo, ViewModel);

            FlexibleLine fl = new FlexibleLine()
            {
                Height = coluna3.Height
            }
            .ComElemento(idEmitente)
            .ComElemento(ifdNfe)
            .ComElemento(coluna3)
            .ComLarguras(0, 15, 46.5F);

            MainVerticalStack.Add(fl);

            AdicionarLinhaCampos()
            .ComCampo("Natureza da operação", ViewModel.NaturezaOperacao)
            .ComCampo("Protocolo de autorização", ViewModel.ProtocoloAutorizacao, AlinhamentoHorizontal.Centro)
            .ComLarguras(0, 46.5F);

            AdicionarLinhaCampos()
            .ComCampo("Inscrição Estadual", ViewModel.Emitente.Ie, AlinhamentoHorizontal.Centro)
            .ComCampo("Inscrição Estadual do Subst. Tributário", ViewModel.Emitente.IeSt, AlinhamentoHorizontal.Centro)
            .ComCampo("Cnpj", Formatador.FormatarCnpj(ViewModel.Emitente.CnpjCpf), AlinhamentoHorizontal.Centro)
            .ComLargurasIguais();
        }
        public BlocoEventoIdentificacao(DanfeEventoViewModel viewModel, Estilo estilo) : base(viewModel, estilo)
        {
            #region Propriedades

            var chaveAcesso = DanfeHelper.FormatarChaveAcesso(viewModel.ChaveAcesso);
            var modelo      = viewModel.ChaveAcesso.Substring(20, 2);
            var serie       = viewModel.ChaveAcesso.Substring(22, 3);
            var numero      = DanfeHelper.FormatarNumeroNF(viewModel.ChaveAcesso.Substring(25, 9));
            var ano         = viewModel.ChaveAcesso.Substring(2, 2);
            var mes         = viewModel.ChaveAcesso.Substring(4, 2);

            #endregion

            var codigoBarras = new Barcode128C(viewModel.ChaveAcesso, Estilo)
            {
                Height = AlturaCodigo
            };

            var coluna = new VerticalStack();
            var linha1 = new LinhaCampos(estilo)
            {
                Height = AlturaLinhaCampo
            }
            .ComCampo("MODELO", modelo)
            .ComCampo("SÉRIE", serie)
            .ComCampo("NÚMERO", numero)
            .ComCampo("MÊS / ANO DA EMISSÃO", $"{mes} / {ano}")
            .ComLargurasIguais();

            var linha2 = new Campo("CHAVE DE ACESSO", chaveAcesso, estilo)
            {
                Height = AlturaLinhaCampo
            };

            coluna.Add(linha1, linha2);

            var fl = new FlexibleLine {
                Height = codigoBarras.Height
            }
            .ComElemento(coluna)
            .ComElemento(codigoBarras)
            .ComLargurasIguais();

            MainVerticalStack.Add(fl);
        }
Exemplo n.º 8
0
            public StructuralGlyph VisitTree(PegNode root, StyleContext context, double lineSpacingFactor, bool isFixedLineSpacing)
            {
                var rootGlyph = new VerticalStack
                {
                    Style             = context,
                    LineSpacingFactor = lineSpacingFactor,
                    FixedLineSpacing  = isFixedLineSpacing
                };

                var line = new GlyphLine
                {
                    Style = context
                };

                rootGlyph.Add(line);

                if (null != root && null != root.child_)
                {
                    VisitNode(root.child_, context, line);
                }

                return(rootGlyph);
            }
Exemplo n.º 9
0
			private StructuralGlyph HandleNewline(StructuralGlyph parent, StyleContext context)
			{
				StructuralGlyph newcontext;

				if (parent is GlyphLine) // normal case
				{
					if (parent.Parent is VerticalStack)
					{
						newcontext = new GlyphLine();
						newcontext.Style = context;
						parent.Parent.Add(newcontext);
					}
					else // parent.Parent is not a VerticalStack
					{
						var vertStack = new VerticalStack();
						parent.Parent.Exchange(parent, vertStack);
						vertStack.Add(parent);
						newcontext = new GlyphLine();
						newcontext.Style = context;
						vertStack.Add(newcontext);
					}
				}
				else
				{
					throw new NotImplementedException();
				}
				return newcontext;
			}
Exemplo n.º 10
0
			public StructuralGlyph VisitTree(PegNode root, StyleContext context, double lineSpacingFactor, bool isFixedLineSpacing)
			{
				var rootGlyph = new VerticalStack();
				rootGlyph.Style = context;
				rootGlyph.LineSpacingFactor = lineSpacingFactor;
				rootGlyph.FixedLineSpacing = isFixedLineSpacing;

				var line = new GlyphLine();
				line.Style = context;

				rootGlyph.Add(line);

				if (null != root && null != root.child_)
					VisitNode(root.child_, context, line);

				return rootGlyph;
			}