LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cannot choose printer when printing HTML report

Solved!
Go to solution

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:

 

undefined

0 Kudos
Message 1 of 22
(4,563 Views)

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

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
0 Kudos
Message 2 of 22
(4,558 Views)

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.

0 Kudos
Message 3 of 22
(4,539 Views)

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.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
Message 4 of 22
(4,531 Views)

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

undefined

 

Run Once

undefined

 

undefined

 

undefined

 

undefined

0 Kudos
Message 5 of 22
(4,502 Views)

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.

0 Kudos
Message 6 of 22
(4,487 Views)

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

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
0 Kudos
Message 7 of 22
(4,485 Views)

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.

0 Kudos
Message 8 of 22
(4,481 Views)

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:

 

  1. Open the Registry Editor. To do this, click Start >> Run and type "regedit", then press OK.
  2. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows.   In this key there should be an entry called Device with values that should match up with your default printer.
  3. Right click on the Windows key, choose "Export" from the menu that pops up, and save the Registration File as printer1.reg.
  4. Leaving the Registry Editor open, change your default printer. To do this, go to Start >> Settings >> Printers and Faxes. Right click on the printer that you want your report to print to, and choose the option "Set as Default Printer".
  5. Go back to the Registry Editor, it should be noted that the value of the Device entry has changed to the new default printer. Right click on the Windows key again, choose "Export" from the menu that pops up, and save the Registration File as printer2.reg
  6. These two files may now be used to manipulate your default printer settings in conjunction with the System Exec.vi. The figures below show how to use the registry files and the System Exec.vi. 


      → The "/s" in the text field makes sure that this vi will run without interrupting regular user interaction.
      → The path constant is set to "c:\" because the Registration Files were saved directly in the C drive. Change according to location of Registration Files.
  7. Make sure that this operation is called before the Print Report.vi is called, as it will print just to the default printer.
Paul Davidson
National Instruments
Product Owner - ni.com Chat
0 Kudos
Message 9 of 22
(4,464 Views)

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.

0 Kudos
Message 10 of 22
(4,435 Views)