View PDF document windows forms

0

Is there any property of viewing a .PDF file from the Click event in PictureBox without having to create a new modal?

Example:

I have this PictureBox , where I created the code below, that as soon as it is clicked the option to print the file, however would like to leave more dynamic, viewing the .PDF and the user chooses if or not print.

Code:

privatevoidpicPDF_Click(objectsender,EventArgse){try{NotasFiscaisobjNotasFiscais=newNotasFiscais();PedidoobjPedido=newPedido();if(objPedido.ConsultarNFPedido(Metodos.empresa,txtNumPedido.Text)>0){objNotasFiscais.NFEmpresa=Metodos.empresa;objNotasFiscais.NFNumero=objPedido.pedNFNumero;objNotasFiscais.NFSerie=objPedido.pedNFSerie;objNotasFiscais.NFCliente=Convert.ToInt32(txtCodigo.Text);objNotasFiscais.NFTipo=objPedido.pedNFTipo;}if(objNotasFiscais.ConsultarNotaFiscal(Metodos.empresa,objNotasFiscais.NFNumero,objNotasFiscais.NFSerie,objNotasFiscais.NFTipo)>0){//if(objNotasFiscais.NFStatus=="I")
                   // {
                        Operacoes operacoes = new Operacoes();
                        string danfe = operacoes.ConsultarDanfePdf(objNotasFiscais.NFEmpresa, objNotasFiscais.NFNumero, objNotasFiscais.NFSerie, objNotasFiscais.NFCliente.ToString(), objNotasFiscais.NFTipo, true);
                        string Filepath = danfe;
                        new PrintPDF(danfe);
                    //}
                }
                else
                {
                    MessageBox.Show("PDF da Danfe não encontrado.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }
    
asked by anonymous 04.01.2018 / 18:52

1 answer

1

I had a similar problem recently and I've been researching something to view PDF in a WindowsForms application and I ended up finding this project Moon PDF .

This is a WPF control so you will need to use a WPF control in your Windows Forms application.

I made a sample project on Github and you take a look at this link .

This used library is available in the nuget gallery at package .

    
04.01.2018 / 19:36