LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Unopenable BMP from PrintCtrl

Trying to print a simple graph, but the fule is unreadable. The function returns success when SetPrintAttribute() is set to either option. I've attached the bitmap which should be roughly as below (yes I know it needs work!)

 

Graph WIP

 

0 Kudos
Message 1 of 8
(3,722 Views)

Hi , can you explain better do you have any error code ?

 

I know there was a problem with the CVI Run-Time engine with some graph issue 

 

http://digital.ni.com/public.nsf/allkb/9423B6B930BE467C862576B700786B14?OpenDocument&metc=ph_Notific...

 

but if you can explain better maybe I'll be able to assist you..

-----------------------------------------
Kobi Kalif
Software Engineer

0 Kudos
Message 2 of 8
(3,697 Views)

Thanks but that didn't make any difference. Opening the file in a hex viewer shows that the start is a load of random print driver settings. I'd say it's looking like a bug at the moment.

0 Kudos
Message 3 of 8
(3,680 Views)

I don't completely understand your situation. Which file is this, exactly? Is this a .bmp file that you are trying to display on the graph? And which SetPrintAttribute options are you referring to?

 

Luis

0 Kudos
Message 4 of 8
(3,664 Views)

The file I attached is a bitmap file produced by PrintCtrl but renamed as this board won't accept .bmp extensions. The SetPrintAttribute options I referred either draws the control to an intermediate bitmap or not. The whole thing is a cheap'n'dirty way to print a graph onto a report, since NIReports doesn't offer this feature and I haven't got the time to spare to do it properly in Word and Excel.

0 Kudos
Message 5 of 8
(3,651 Views)

As far as I can understand you want to obtain an image out of your graph and include it in a report with NIReport_AppendImageFile.

If this is your situation you could:

 

1. Obtain a bitmap of your graph control with GetCtrlDisplayBitmap

2. Save the bitmap to a file with SaveBitmapToBMPFile or SavebitmapToJPEGFile

3. Discard the bitmap

4. Append the image tot he report

 

The file you obtain from PrintCtrl is a print file (i.e. a file intended to be sent to the printer, that includes control codes for the printer). The intermediate bitmap optionally used internallyby PrintCtrl is not available for direct use.



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 6 of 8
(3,645 Views)

Thanks, that clears things up nicely. I have been using GetScaledCtrlDisplayBitmap, but am having to save at 2/3 scale and the image is blurry. I think we're becoming victims of ever increasing screen resolution, since the size of paper never changes.

 

 

0 Kudos
Message 7 of 8
(3,631 Views)

You could duplicate the graph on a hidden panel and rescale it before getting the image of the control: with auto divisions on at least axes and grid should maintain a good aspect even on small sizes.



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 8 of 8
(3,627 Views)