LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set printing margins of report?

Solved!
Go to solution

Hello,

I am trying to print programmatically a portrait of a JPEG image that has been created by a Front Panel.

I print it by creating a Standard Report.

While the JPEG image is fine, the printed image is compressed at the long edges. So, the printed image is a little bit distorted.

I change the Printing:Margins Property of the vi at the First Call of the vi, but the result is the same.

On the other hand, if I open the JPEG image with a program like Picasa and print it, the printing image is not compressed/distorted.

 

I attach an image of the code that is used to print the JPEG and an image that shows the Printing:Margins Property.

 

How can I print it correctly via LabVIEW?

Download All
0 Kudos
Message 1 of 16
(6,019 Views)

Hello,

 

The property node you use to set the margins only affect the VI, that means it's relevant only if you print the VI's front panel using the "Print" method.

 

print_2.png

 

To set the margins of a report there is a function in the report attributes subpalette.

 

print.jpg

 

Hope this helps


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 16
(6,004 Views)

I use the "Set Report Margins" as it is shown in the image Print_code.JPG.

After your reply, I changed these values and I succeeded merely to change the position of the printing image, without avoiding the compression on the long edges.

I use the margins values "0.05 - 0 - 3 - 0.05" to align the image in the center, but the distortion remains.

 

What else should I try?

 

Thank you.

0 Kudos
Message 3 of 16
(5,988 Views)

Try switching the report type from standard to html and printing it that way. Let me know if that fixes the issue. I believe this is an bug that we have with the Append Image to Report.VI when used with the standard report type. This bug is currently being investigated by R&D.

 

Paul

National Instruments | Applications Engineer | www.ni.com/support
0 Kudos
Message 4 of 16
(5,957 Views)

Hello,

 

I used the HTML report instead of Standard and I have the following results:

1. The printing image is no longer compressed/distorted.

2. The printing image is about 30% smaller than the original.

3. There have been appended html info to the page ("Page 1 of 1" at the top, the path & data at bottom).

4. It cannot be virtually printed to Adobe PDF.

 

What should I change to make it perfect?

Thank you very much.

Here is the code:

 

Capture.JPG

0 Kudos
Message 5 of 16
(5,936 Views)

Hi nikofs,

 

Could you provide me a little bit more information about the jpeg that you are trying to print and how you are acquiring it programmatically. If you could show me that portion of your code as well I can try to replicate exactly what you're doing in order to verify the behavior on my end. Any other information regarding the image, like the dimensions, would be helpful as well. Thanks for your patience and cooperation. I look forward to hearing back from you.

 

Paul M.

National Instruments | Applications Engineer | www.ni.com/support
0 Kudos
Message 6 of 16
(5,918 Views)

Hello Paul M.

I have created 2 demo vi files that show the procedure of creating a Front Panel's JPEG image and the the procedure of printing it.

Thank you very much for your help.

 

Download All
0 Kudos
Message 7 of 16
(5,899 Views)

PS: I use LabVIEW 8.2.1

0 Kudos
Message 8 of 16
(5,895 Views)
Solution
Accepted by nikosfs

Hi nikosfs,

 

So I've been taking a look at your issue a little bit more and unfortunately I haven't found a solution that meets all of your needs. I was able to improve the appearance and size of the HTML report by modifying the registry key entries for the printer settings of Internet Explorer. You have to do this because the HTML report print settings refer to these registry keys rather than the margin settings that you set up in LabVIEW. I've gone ahead and linked the Microsoft support article below. These registry keys will not only allow you to change the default margins, but they will allow you to remove the header and footer. However, I wasn't able to get the HTML report to print on the pdf printer that I had installed as you had mentioned. Another method you could use to print the front panel image is through the invoke and property nodes for the Report.VI reference. The property node for this VI reference allows you to set the printing margin and the header settings. Then you can use the invoke node to print it. However, once again, using this method I wasn't able to successfully print to a pdf either. Consequently, it seems if you want to print to a pdf accurately, the ideal solution would be to use a Word report type since the standard report has the bug that I mentioned earlier. You can monitor the status of this bug using CAR# 49253. Let me know if you have any more questions I apologize that we weren't able to find a ideal solution for your needs.

 

http://support.microsoft.com/kb/236777

 

Paul M

National Instruments | Applications Engineer | www.ni.com/support
Message 9 of 16
(5,833 Views)

Hello,

I tried the solutions that you proposed and I have the following results:

1. The solution to print the Front Panel through the invoke node of the vi's reference is not ideal, because the desirable printer cannot be chosen.

printUsingInvokeNode.JPG

2. I cannot use the Word Report because I have not the Report Generation Toolkit for Microsoft Office.

3. I used the HTML Report and I change the print settigns by modifying the registry keys in the following folder:

"HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup"

I can change the margin_bottom, margin_left, margin_right, margin_top, Shrink_To_Fit and assign the values 0,0,0,0,no to them.

The result in the printing image is obvious. It is no longer compressed and it is positioned almost according to the margins. Although all margins are set to 0, it has to be positioned 2cm more at left and about 2cm higher to be proper.

But the footer and header registry keys even if they are deleted (I cannot assign empty string from command line), they are appeared in the printed page.

 

I attach the new vi files that modify the registry keys of the above folder before printing and restore them after printing.

Also, the Front Panel size of the Report.vi has been changed and set equal to the A4 paper size 21x29cm and a little bit bigger in order not to print the decoration border.

 

So, the problem of proper printing of HTML report remains having only to remove the footer & header and understand why the printing image is not positioned at full left and full top even if the registry keys margin_left and margin_top are 0 and 0.

 

On the other hand, if the vi's Front Panel JPEG image is printed from a Photo-program, it is printed correctly given that the margins are set to 0 and the "Scale" option has been disabled.

 

Thank you very much for your help.

I am looking forward to hearing from you if it is possible.

Download All
0 Kudos
Message 10 of 16
(5,806 Views)