 NikoWenz
		
			NikoWenz
		
		
		
		
		
		
		
		
	
			08-29-2017 06:23 AM
Hi Community,
my goal is to print a rtf document with the .net Framework. As a reference i used the MSDN article.
The problem is that the constructor PrintPageEventHandler needs a reference to a method. In the source code this is PrintPageEventArgs, but in LabVIEW i cant connect the ReferenceOut of PrintPageEventArgs and method.
08-30-2017 01:44 AM - edited 08-30-2017 02:00 AM
I made some changes, but still i dont know what need to be connect with the method 😞
08-30-2017 07:12 AM
Another try 😄
This time the Programm works but the document i print is empty. Is the position of the graphics wrong or does anyone know how to print properly with PrintDocument?
 mikhail.musienk
		
			mikhail.musienk02-15-2019 02:08 PM
@NikoWenz wrote:
The problem is that the constructor PrintPageEventHandler needs a reference to a method. In the source code this is PrintPageEventArgs, but in LabVIEW i cant connect the ReferenceOut of PrintPageEventArgs and method.
This is an old thread, but for whomever wanders here looking for using .net to print from LabVIEW -
To do the above, refer to https://forums.ni.com/t5/Developer-Center-Resources/Register-Callback-VIs-for-NET-Events-in-LabVIEW/...
There are also examples in LabVIEW itself (search by .net keyword).
You need to create a second VI that will act as a callback to your printPage() event.
In that vi you will need to use "Event Data -> e -> Graphics" methods to provide information to print.
Attached is an example that prints an image from file to a PDF. To print your RTF you will need to replace "Image.FromFile" and "DrawImage" to your StreamReader and corresponding drawing functions.