Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: PDF Viewer
PostPosted: Mon Nov 11, 2013 1:18 pm 

Joined: Fri Aug 10, 2012 8:50 am
Posts: 44

Offline
Is there an option on not to use the open file from the PDF Viewer and instead use a custom button to open the specified file directly?


button 1 open x.pdf file
button 2 open x2.pdf file and so on?

In that way I do not get the prompt box for what doc I want to open.


Thnaks


 Profile  
 
 Post subject: Re: PDF Viewer
PostPosted: Mon Nov 11, 2013 3:33 pm 

Joined: Thu Jun 06, 2013 9:21 am
Posts: 61

Offline
Please check out this msdn resouce as well:

http://msdn.microsoft.com/en-us/library ... 10%29.aspx

1) Create a button on the canvas
2) Place the PDFViewer on the canvas
3) Click on the Script Tab
4) Write an event handler for your button(see code below)

void Button1_Click(System.Object sender, System.EventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();

if(fd.ShowDialog() == DialogResult.OK) {
PDFViewer1.FileName = fd.FileName;
}

}


 Profile  
 
 Post subject: Re: PDF Viewer
PostPosted: Mon Nov 11, 2013 4:34 pm 

Joined: Fri Aug 10, 2012 8:50 am
Posts: 44

Offline
Thanks for the feedback. But it looks like OpenFileDialog is the same as clicking on the open button from the PDFViewer and selecting a file. The idea is to click on the custom button an automatically open the pdf file using the PDFViewer w/o selecting a file from a list.

Thanks


 Profile  
 
 Post subject: Re: PDF Viewer
PostPosted: Mon Nov 11, 2013 4:49 pm 

Joined: Fri Aug 10, 2012 8:50 am
Posts: 44

Offline
I got it. Thanks for your help.


 Profile  
 
 Post subject: Re: PDF Viewer
PostPosted: Wed Mar 30, 2016 1:12 am 

Joined: Fri Feb 26, 2016 9:42 am
Posts: 8

Offline
Hi,

I need to open a PDF file from a button and I tried the example of stuartm but it didnĀ“t work.
Why did you choose PDFViewer1 ?

I can see in my script PDFViewer without 1 and I put Variadorabb instead of Filename because my file has this name.

void Button26_Click(System.Object sender, System.EventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();

if(fd.ShowDialog() == DialogResult.OK)
{
PDFViewer.Variadorabb = fd.Variadorabb;
}
}

Regards.
Antonio


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: