Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var selecionado = notasBindingSource.Current as Notas;

            try
            {
                string caminhoPDF = SalvarTemp.Salvar(selecionado.Caminho);

                FileInfo file = new FileInfo(caminhoPDF);

                if (file.Exists)
                {
                    Process process = new Process();
                    Process objP    = new Process();

                    objP.StartInfo.FileName = caminhoPDF;

                    objP.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden; //Hide the window.
                    objP.StartInfo.Verb           = "print";
                    objP.StartInfo.CreateNoWindow = true;
                    objP.Start();

                    objP.CloseMainWindow();

                    MessageBox.Show("Arquivo enviado para sua impressora padrão");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        private void VizualizarButton_Click(object sender, EventArgs e)
        {
            var selecionado = notasBindingSource.Current as Notas;

            if (selecionado == null)
            {
                MessageBox.Show("Selecione uma linha por favor!");
                return;
            }


            try
            {
                string caminhoPDF = SalvarTemp.Salvar(selecionado.Caminho);
                System.Diagnostics.Process.Start(caminhoPDF);
            }
            catch
            {
                MessageBox.Show("Verifique se o arquivo .XML esta na pasta correta");
            }
        }