NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
RGSchmidt
Posts: 75
0 Kudos

Saving and Printing Files using Web UI

I have a LabVIEW app that decodes and then post-processes a file extracted from a camera. The file contains boot and history data that the user may want to save and/or print.

 

I need to convert this app to a thin-client since half of users run on Mac and the other half on PC's.

 

The issues that I am having are:

(1) The file to be post-processed resides on the client machine running the Web UI and I need to transfer this file to the server for processing - how can I transfer the file from client to server?

(2) The user can select a boot log within the file to edit, save and/or print - within the PC I can just launch Notepad but is there an equivalent capability with Silverlight since the Web UI does not know which OS is running? Is it possible to save the file locally? Is it possible to send the file to the default local printer?

 

I know that Silverlight 3.0 allows use of a Save Dialog box, how can I get access to that functionality? None of the saves are without user interaction since they must request to save or print a file from the Web UI.

Member
Kyle-H
Posts: 153
0 Kudos

Re: Saving and Printing Files using Web UI

RG,

 

Please see this forum as it has good details covering alot of the file aspects you are looking for. 

http://forums.ni.com/t5/LabVIEW-Web-UI-Builder-and-Data/How-can-i-make-hyperlink-to-local-file-for-d...

 

You could read the file on the server and pass it to the web ui client.

 

Printing is another story. If they are networked printers (assuming multiple) then you ask the user which printer to print to and then pass that information back to the server and have the server, full LabVIEW, send to the printer.

 

Kyle Hartley
Applications Engineer
National Instruments
Member
RGSchmidt
Posts: 75
0 Kudos

Re: Saving and Printing Files using Web UI

Thanks.

 

I had looked at that thread and it appears to only work moving files one way (to the server).

 

How can I save any files created locally on the client machine? I am not sure the thread addresses this issue.

Member
malcolmsmith
Posts: 38

Re: Saving and Printing Files using Web UI

1. Web UI Builder doesn't expose Silverlight's file open dialog right now. If you need to let the user be able to browse to a local file and upload it to the server. In order to do this with Web UI Builder, you'd probably need to make a hybrid HTML page (part Web UI Builder deployed application, part HTML forms). On the HTML side you could use a standard file upload form to get the file to the server. To access the file from a LabVIEW web service, this may help: http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/ws_post_form_upload/

 

2. Similarly, the file save dialog isn't exposed right now. However, you can write a web service that lets you access files from your LabVIEW server, and then sets the Content-Disposition header to trigger a file download. (GregR's responses in the thread Kyle linked should help with that.) In order to trigger the file download in UI Builder, you'd point the an instance of the Hyperlink Control's URL to that web service.

Member
Kyle-H
Posts: 153
0 Kudos

Re: Saving and Printing Files using Web UI

RG,

 

Sorry I misunderstood the path of your question. You could use the same method if the files were hosted again on the client computers using a http server. 

 

Could you use a list box to display data, edit, and then the user can press a button to push it back to the server? Are you set on using notepad or another program to modify the files?

Kyle Hartley
Applications Engineer
National Instruments
Member
Kyle-H
Posts: 153
0 Kudos

Re: Saving and Printing Files using Web UI

I meant to edit my post look into HTTP post command to gather the file since you'll know the path of the file when you save it to the computer.

Kyle Hartley
Applications Engineer
National Instruments
Member
RGSchmidt
Posts: 75
0 Kudos

Re: Saving and Printing Files using Web UI

Hi Kyle,

 

They are not editing the file just using notepad or equivalent to view it since files can be rather long. Notepad allowed for searching the file or even printing it out.

 

I can use a listbox for displaying but no easy way to search but I will live with that right now as long as I can implement a way to to save file locally so that user can open file and manipulate/view or print it.

Member
RGSchmidt
Posts: 75
0 Kudos

Re: Saving and Printing Files using Web UI

Thanks Malcolm.

 

Let me see if I can get this implemented and see how it works.

 

It would be nice if the file dialog in Silverlight were exposed for use in Web UI. It would makes things a lot simpler

Member
RGSchmidt
Posts: 75
0 Kudos

Re: Saving and Printing Files using Web UI

I tried the link to the other posts but unable to get the either IE or Firefox to prompt to save the file. I have tried under latest version of IE and Firefox.

 

It copies the file but I never get the prompt to Save the file ... The Content-Disposition from HTTP forums say this should work.

 

I have code snippet in HTML file I wrote that verifies the browser prompts for file to save.

Member
Kyle-H
Posts: 153
0 Kudos

Re: Saving and Printing Files using Web UI

RG,

 

Is it that your options in IE/Firefox are to automatically download the file?

 

In firefox go to options and under the general tab check to make sure it says prompt for each file download.

Kyle Hartley
Applications Engineer
National Instruments
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page