Page 1 of 1

Tag to Open File in PDF Viewer

Posted: Sun Jan 06, 2013 6:40 pm
by Sarah
Hi,

Is it possible with scripting to open up specific files in THE PDF viewer based a on a tag value? If so, how should I go about doing this?

Thanks for your hlep.

Re: Tag to Open File in PDF Viewer

Posted: Mon Jan 07, 2013 9:39 am
by mark.monroe
You can fire the code below when a tag value changes for example. Or when a tag value is a specific value. You can use the ValueChange event found in the lower left corner of the Tags tab, called Script.

Code: Select all

		void Button1_Click(System.Object sender, System.EventArgs e)
		{
			this.PDFViewer1.FileName = "C:\\MyDir\\WherePDFsAre\\adp3_manual.pdf";
		}

Re: Tag to Open File in PDF Viewer

Posted: Tue Jan 08, 2013 9:28 pm
by Sarah
Thanks Mark! Just in case, is it also possible to specify a page number with it?

Re: Tag to Open File in PDF Viewer

Posted: Wed Jan 09, 2013 8:54 am
by mark.monroe
Yes you can. Just use the auto-complete feature in C# to list the available functions on the PDFViewer Object.

Re: Tag to Open File in PDF Viewer

Posted: Tue Aug 06, 2013 2:35 pm
by bennanio
What's the full path on the device its self? I'm getting an error at runtime where it can't find the file but I've put it in every possible location. It's getting installed (you can browse manually and find it using the open button) but I can't figure out the path.
I've even tried just setting at compile time using the drop down menu but that doesn't work either. When the screen loads i get an error that it can't find the file.

Re: Tag to Open File in PDF Viewer

Posted: Wed Aug 07, 2013 8:09 am
by mark.monroe
If you are using a HMI that runs WinCE, then it will not have any drive letters and the "C:\" path is not valid. Paths that start with "C:\" are only valid when your iX project runs on a PC. You can take a look at this forum post and it talks a little about paths. There are lots of posts about paths on this forum.