LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Controls moving while printing

In my application I need to print some graphs with trends during test. To enhance the graphs aspect I want to add a box around the plot area (the 3d aspect of graphs disappears during printing) and I create a flat box wit transparent interior and place it in the proper position basing on the ATTR_PLOT_AREA_xx attributes of the graphs.

If I see the panel on the video or create a bitmap from it the boxes are correctly placed, but when I print the panel the left side of the box shiftes a little towards the right, invading the plot area.

What can be happening? To print the panel I simply draw the background in white, hide the "Print" button and send to the printer by
error = PrintPanel (tmpH, "", 1, VAL_FULL_PANEL, 0);

Anyone ha
s an adie on it?

Attached a sample bitmap and the resulting pdf produced (identical to the actual printout).

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 1 of 7
(3,552 Views)
Roberto,

Whenever a CVI panel is printed, it needs to undergo a lot of changes having to do with differences in resolution between the screen and the printer. The final result should be pretty close to what is one the screen, but it is not guaranteed to be identical, pixel-for-pixel. Another factor that certainly interferes with this is the difference in fonts. The Windows fonts are not identical to the fonts available to the printer, and even though we try to find the best match, differences remain. (You can probably notice them, if you examine any one character in the two images that you attached). In this case, the different fonts will affect the bounds of the plot area, since these bounds are dependent on the space taken up by the graph axes, which in turn are d
ependent on the fonts that they use.

I wish I could give you a full-proof workaround, but the only possibilities that come to my mind are:

a) try different fonts for the axis labels of the graphs. You might get lucky with some of them...

b) try different printout sizes. You can tweak them using the ATTR_PRINT_AREA_HEIGHT and ATTR_PRINT_AREA_WIDTH attributes.

c) in anticipation of this shift, move your decoration box to the left just before you call the printing function, and then restore its position afterwards.

d) use bitmap printing (ATTR_BITMAP_PRINTING). This will guarantee that everything will be in its proper place, but you probably won't be happy with the quality of the text and the plot lines...

Luis
NI
0 Kudos
Message 2 of 7
(3,552 Views)
Luis,
I was afraid of receving such an answer...

The problem is that all the options you mentioned, apart from bitmap printing whose output is not so good as customers want, produce unpredictable results when you install the application in your customer's computer, with its proper settings, installed characters, graphich cards, different printers and so on...

Maybe this item could be added to the wish-list for CVI updates, since in a graph with white plot area and white border the plot area border is completely invisible (at least two sides on four): adding a flat border or some ticks on the upper and right border of the graph could help in reading a printed graph.

Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 7
(3,552 Views)
Roberto,

Just another idea here:
You could generate a HTML report that incluides images of the plots and adds the required text; then use ActiveX to open and print the HTML file. This could give you the benefit of a bitmap of the ghraphs with the high quality fonts of HTML. You can also save this report as a backup.

You probably know this site, but here is the link to a set of functions you can use to generate jpg and png images.

By the way, you can generate a product suggestion by going to http://www.ni.com/contact and select product feedback.

Hope that helps.

Juan Carlos
N.I.
0 Kudos
Message 4 of 7
(3,552 Views)
Fair enough. We can't do anything about the movement of the controls, and I understand your point about the unpredictable results on different computers, but we can investigate what is going on with the borders.

In the meanwhile, you might want to try printing in B&W mode (instead of color or grayscale). If you don't care about showing the plot lines in color, you might want to consider it, since it should preserve the plot area lines.

- luis
0 Kudos
Message 5 of 7
(3,552 Views)
What I have done in the past to get round problems like this is first to copy the panel, resize the copied panel to something very large (i.e. an appropriate size in pixels for a printer), print it using bitmap printing, then dispose of the copied panel. You can do all this without having to display the larger panel at all, so it looks pretty seamless.

Martin.
--
Martin
Certified CVI Developer
0 Kudos
Message 6 of 7
(3,552 Views)
I have tried it with no results by sizing the panel to print to approx 1400 by 1000 pixels and then two times more: I guess the problem lies in redimensioning, that accomplishes the same calculations and approximations that Luis has mentioned.

I suppose bitmap printing produces the best result when there is a 1 to 1 relation between pixels and printer dots, but with the resolution that have printer at present this is practically unreachable...

Maybe I should:
1. Resize the panel
2. Create the boxes using the dimensions of the large panel
In this way the aproximation errors in calculation should minimize so that the aestetic effect is quite optimal. I'll try...

Thanks all for the suggestions.
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 7
(3,552 Views)