Printing part of a page ?


Recommended Posts

I have used the Print(Page) action of a button component on the bottom of a page popped up modeless to send the page to the printer. This of course prints the whole page including the button(s). Is there a way to print a given area of the page so that the desired area alone is printed and thus avoid the buttons.

The pages that I want the user to print are generally a report page that has perhaps a dozen variable components and various controls. I would prefer not to print the controls, just the data. Alternatively can individual values be sent to the printer as then I could simply send the dozen or so values.

There is one page that has a graph with Title, subtitle and up to three titled Y axes and a titled X axis with three buttons below it at the bottom of the modeless popup. It would be good if the user could print the graph without the buttons as well.

Thanks,

Martin

Link to comment
Share on other sites

Three ways:

1) create a duplicate page without the buttons and print that page instead. Just remember that you have to go to that page once before printing to initialize the graph. You can do that in script as it describes in the section on the DF web server in the help (the web server has the same requirement)

2) you can use the capture() function to capture a portion of the screen to a JPEG and then print the jpeg, but the quality won't be as good.

3) name your graph and then call its printgraph() function:

component.mygraph.printgraph()

This, however, will popup the graph's print/export window where the user can select whether they want to print the graph, export it as an image, or as data columns. It does not automatically send it to the printer

Link to comment
Share on other sites

The easiest, best, most secure and most reliable way to make data available on a network is to use DAQConnect (www.daqconnect.com). Alternatively, you can use DAQFactory networking where you have multiple installations of DAQFactory, but then the pages can be different: only the data is being shared. Same goes for DAQConnect actually.

Link to comment
Share on other sites

I have tried the duplicate page (without the controls). It needs script in the original "Print" button to change to the duplicate page then print the page etc. This stopped DF responding so after trying closing the popup (original page) I tried having the original "Print" button on the original popup page having three separate actions.

The first is to hide all 6 controls with Component....Visible = 0

The second is the original PrintPage

The third is show the hidden controls again and as PrintPage brings up the page to be printed full screen an additional Page.StrCurrentPage = "MainPage"

This works well on two fairly similar pages that are composed of around 15 VariableValue components each.

However, a third page that comprises A table component having seven rows, the first of which is an array of 5 strings to give row titles.

The sixth is again an array of 5 identical strings "+/-" so that this is shown for each row of the table. The second to fifth row and the seventh row have numerical arrays of the data. This all displays fine in the popup but when just using PrintPage on its own, without even hiding the controls, it prints out the Table titles and the row titles from the first row string array with out any data. So what is different about printing table components?

I will now proceed with the popup page that has a Graph component.

Thanks

Martin

Link to comment
Share on other sites

Solved my table printing! It was me being stupid!

I had the page set to brown background as was the background of the first table row and the table titles but not the other table rows so the printer tried to print white on white paper.

There is one born every day!

Martin

Link to comment
Share on other sites

You can print a secondary page without switching to it. You have to switch to it once at startup, but after that you should be able to print it directly from script without changing the page. Your solution of making things invisible, printing, then reshowing them will only work if you give a nice pause after making them reappear because of the way messaging works in windows. The printing runs async and so if you don't wait, the controls may reappear before the print is done.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.