Gammatech Posted May 26, 2010 Share Posted May 26, 2010 Hi, My application has at the moment two sub pages that can be popped up modeless (only one at a time) that show specific data views. One is a table component with 6 rows and 6 columns with 4 buttons labeled 'Clear', 'Pause', 'Reset' & 'Print'. The other has a graph component with 3 buttons labeled 'clear', 'Back' & 'Print' The intention of the print button on each pop up sub page is to send the image on the sub page to the printer. As I don't want the buttons to appear on the print out the 'Print' button has 3 actions: 1) "Quick Sequence" // Hide the buttons Component.Button1.Visible = 0 Component.Button2.Visible = 0 Component.Button3.Visible = 0 2) "PrintPage" TrendDisplay 3) "Quick Sequence" // show the buttons Component.Button1.Visible = 1 Component.Button2.Visible = 1 Component.Button3.Visible = 1 // Display the main page Page.StrCurrentPage = MainPage // Close the pop ups Page.TrendDisplay.ClosePopUp() Page.Trend.ClosePopUp() The string variable MainPage has the correct main page for the program variant loaded at start up In the case of the popped up table page there are 4 buttons to hide and then re-show so an extra line in actions 1 and 3. There is only one sub page to close so action 3 only has one closepopup() command. This system sometimes works as expected printing the page and then returning to the main page but often after the dialogue box to select the printer has been accepted the next small panel with the printer description pops up and DAQfactory freezes (Not Responding) It doesn't seem to make any difference whether I press the print button on the popup sub page or with the page selected in the workspace. It seems to be random, sometimes it works sometimes it hangs up. Any suggestions as to what I'm doing wrong or alternative method to accomplish the desired end? Martin Link to comment Share on other sites More sharing options...
AzeoTech Posted May 26, 2010 Share Posted May 26, 2010 Yeah, that might throw the system. Typically, when you want to print a page without the normal buttons, you should do the same thing most web based systems do: create a duplicate page without all the buttons and print that instead. That all said, there are some issues with certain printers just creating blank pages. Alas, its often HP printers. It has something to do with their driver. Anyhow, in this case, you might consider using Page.Capture() instead and capturing the page, or part of the page, to a jpeg, then printing the jpeg. Or alternatively, use page.printpdf() and print it to a pdf. This creates a cleaner printout, but only really works with graphs, tables, and text elements (variable value, descriptive text, etc). Gauges, images, etc don't work. Link to comment Share on other sites More sharing options...
Gammatech Posted June 16, 2010 Author Share Posted June 16, 2010 OK, I've added the code to copy the build of the chart display to a secondary page used for printing. My print button on the display page simply prints the secondary print page. I thought it would be nice to have the company logo on the printed page exactly as it is displayed on the main page. I copied the Symbol component that is the logo to the secondary print page and it looks exactly as I want. When it prints the symbol is there on the print out but only about 2mm by 12mm rather than the 20 by 120 it is displayed on the screen as. How do I make the symbol print at the display size? Martin Link to comment Share on other sites More sharing options...
Gammatech Posted June 16, 2010 Author Share Posted June 16, 2010 Another thing. Is it possible to change the printer to landscape in script or is the only way to do it on the printer dialogue box by hand? Martin Link to comment Share on other sites More sharing options...
AzeoTech Posted June 16, 2010 Share Posted June 16, 2010 The symbol is printing at 1:1. Remember, a screen is 72 pixels per inch, and your printer probably 300 or 600. DAQFactory can't scale it before printing. As for changing the printer orientation: no, I'm afraid not. Link to comment Share on other sites More sharing options...
Gammatech Posted June 25, 2010 Author Share Posted June 25, 2010 OK. I scaled up the company logo symbol component by 4 to see what effects I got. Obviously on the displayed page the symbol overwrites part of the page content. When printed the logo is close to the required size but offset down the page. The positioning that I want on the printed page to make it similar to the main page is: Left = 4 Top = 4 Right = 227 Bottom = 61 Implying a width of 223 and a height of 57. Scaling by 4 I set left and top the same and to get width as 892 I set right as 896. Similarly for the height I set Bottom as 248. This produced a printed page with the logo approximately the correct size but still significantly offset down the printed page. Reducing the left coordinate to zero shrunk the printed page without materially affecting the size of the logo. Reducing the top coordinate to zero after resetting the left coordinate to 4 did have the logo move up the again correctly sized page somewhat but not by nearly enough. Taking the top coordinate negative to -30 and the bottom coordinate to 214 so that the correct height was maintained displayed the 4x over size logo with the top off the top of the screen but this printed out with the logo still offset down the page as before so presumably the print function passes negative top coordinates as zero. Any suggestions as to how either to position the scaled up logo correctly in the top left corner of the printed page or produce the logo by some other method than as a symbol component. The Text component that is displayed centrally at the top of the displayed page prints correctly. Our logo is fairly simple being two lines of text in italic font after a double height lower case Greek gamma character (occupying the same height as the two text lines) I have not found a lower case Greek gamma in the text character set. Regards, Martin Link to comment Share on other sites More sharing options...
AzeoTech Posted June 30, 2010 Share Posted June 30, 2010 If your logo is made up of standard text, I'd spend some time figuring out which fonts actually have the character you need. I find using Microsoft Word and the Insert Symbol feature to be real handy to find a particular character. You can then cut and paste into the DAQFactory properties window as long as you select the proper font in DAQFactory as well. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.