03-15-2011 02:04 PM
Hello,
I have lost many many hours trying to print correctly a report that is composed only of a JPEG image.
After a conversation in the forum, I concluded that the LabVIEW has a bug printing Standard Reports, as it cannot manipulate correctly the margins and the scale of the image. But, when using Standard Reports I could choose which printer to use.
So, I use HTML Reports that print the report smoothly, but the choise of the printer has a problem. No matter which printer is chosen by a Ring Menu, it prints to same printer all the time.
Could you please give me any hint to solve this problem?
I attach the corresponding code:
Solved! Go to Solution.
03-15-2011 02:46 PM - edited 03-15-2011 02:48 PM
Hi,
As far as I know, you can only print a HTML file to the default printer. So if you want to print the HTML to a printer, make sure it's the default one.
But since you want to use the print function, if you choose standard report, then it will work fine.
Or create a report in Excel or Word
03-16-2011 03:28 AM
I cannot use Standard Report because it has a bug when appending an image and printing it.
I have written for this problem in the forum, in another post.
So, the only way to print HTML Report and choose the printer, is to create it in Word? How is it done this?
Thank you very much.
03-16-2011 05:49 AM
Hi nikosfs,
If you read help file for "Print report " vi it says
"If you print an HTML report, the VI ignores this(Printer name) input and uses the default printer for Internet Explorer."
what you can do is, the printer to which you want to send file, make it default at your end.
03-17-2011 04:57 AM
I tried another solution but is has also a problem. I use the registry values to change the default printer and then I restore it.
Firstly, I read the registry value of the default printer.
(HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device)
Secondly, I change the registry value with the name of the printer that the user choose and the data of the corresponding printer that are in this key:
HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices
Then, I print the report to the default printer that is temporarily the user's choise.
Finally, I restore the default printer.
But, the problem is that only the first time LabVIEW can print to the printer that the user choosed. Then, it only prints to the printer that the user choosed the first time. However, the registry value has the default printer always. Furthermore, I probe the printer name that the user choose, while the program runs, and it shows the right printer indeed.
What may cause this problem?
Thank you very much.
Here is the code:
Run Once
Run Once
03-17-2011 10:59 AM
What is more, the number of copies in the Print Report function, doesn't seem to work, when using HTML Report. I have a control that changes the number of copies, but it prints always only one.
03-17-2011 11:05 AM
Hi,
About the WORD report, you can find it in the examples :
C:\Program Files\National Instruments\[LabVIEW folder]\examples\office
Open the llb-file : Word Reports.llb
03-17-2011 12:32 PM
I don't have the office folder in the examples, probably it is a module that I do not have.
So, it would be nice if there was a solution to the problem of the HTML report that I described above.
Thank you.
03-18-2011 04:13 PM
Hey guys, this is Paul with National Instruments.
Being employed at NI I am obligated to provide a big disclaimer about the information I am about to provide:
MANUALLY CHANGING YOUR WINDOWS REGISTRY CAN CAUSE CORRUPTION AND ERRORS IF YOU ARE NOT CAREFUL. DO SO AT YOUR OWN RISK.
With that being said, nikosfs was on the right track by editing his Windows Registry to perform this action. Please see the following steps, and see if it helps further explain what you need to do:
03-19-2011 05:24 AM
Dear Paul,
It is not useful to export the registry value of the default printer each time it is changed by hand, and then load the registry value of the chosen printer, because this method will not work to another system except mine.
My code reads the registry values of all installed printers and it change them accordingly, so it is flexible to run in any PC.
However, does it worth to try to export the registry values of the installed printers and load the corresponding values of the chosen printer?
By this way, will LabVIEW be less vulnerable when updating the registry?
I mention again that the problem is that despite changing the registry value of the default printer successfully and restoring it again after printing, the printer that is chosen by the system the first time is the same with the user's choise, but all the other times, the printer that is chosen by the system is that of the first time independently of what the user choosed.
Is it a bug of LabVIEW that I can surmount, or I do something wrong?
Thank you very much.