Tag to Open File in PDF Viewer

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
Sarah
Posts: 12
Joined: Tue Dec 11, 2012 12:43 am

Tag to Open File in PDF Viewer

Post 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.

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Tag to Open File in PDF Viewer

Post 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";
		}
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Sarah
Posts: 12
Joined: Tue Dec 11, 2012 12:43 am

Re: Tag to Open File in PDF Viewer

Post by Sarah »

Thanks Mark! Just in case, is it also possible to specify a page number with it?

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Tag to Open File in PDF Viewer

Post by mark.monroe »

Yes you can. Just use the auto-complete feature in C# to list the available functions on the PDFViewer Object.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

bennanio
Posts: 14
Joined: Thu Mar 01, 2012 11:48 am

Re: Tag to Open File in PDF Viewer

Post 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.

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Tag to Open File in PDF Viewer

Post 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.
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

Post Reply