Hello,
is there anybody who can explain me the easiest way to print the text of an ultratexteditor?
Best regardsIsiraider
Me again... :)
Now I know why I just saw some black points in the UltraPrintPreviewDialog. It was because of the printer's driver which is installed on the server. It seems like they are not compatible... I created a forwarding from LPT1 to a local Printer with another driver and it works!
Thank you very much! Now I can try to modify the document's layout... :)
Hello Matt,
thank you again! I was already at this point... I also added a UltraPrintDocument as Document to the UltraPrintPreviewDialog, but I didn't find out how to add my text to the UltraPrintDocument. With your following code I just can see some black points in the UltraPrintPreviewDialog:
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e){ e.Graphics.DrawString(this.ultraTextEditor1.Text, this.Font, Brushes.Black, new PointF(0, 0));}
I can say that this is more than I have had before :) but how I have to modify the UltraPrintDocument to see a whole page including my text in the PrintPreviewDialog?
I can't understand the code in the topic "Using the Infragistics.Documents code library with an UltraPrintPreviewDialog". :-(
There is nothing specific to the UltraTextEditor in this case. What you need to do is use a .NET PrintDocument and PreviewPreviewDialog, setting the Document property of the dialog to the instance of the document on your form. Then, you need to handle the PrintPage event of the PrintDocument in order to draw the string yourself. Unfortunately, when you get to the point of wanting to control the layout of the object, you will still have to do some more complex positioning calculationgs, so you may want to revisit using the Documents engine later combined with the forum post that I linked earlier.
A quick sample of drawing the text would be, after setting up the PrintDocument and PrintPreviewDialog mentioned above:
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e){ e.Graphics.DrawString(this.ultraTextEditor1.Text, this.Font, Brushes.Black, new PointF(0, 0));}private void button1_Click(object sender, EventArgs e){ this.printPreviewDialog1.ShowDialog(this);}
-Matt
I think I am maybe to stupid for this printing thing...
I just need a solution which gives me the opportunity to set the UltreTextEditor's text to any object (must not be such a Report object) you recommend and then print this object with a print dialog.The text's format and the document's format is not so important.
Isiraider,
There isn't any intrinsic support for displaying the contents of a Report object in a PrintPreviewDialog. Fortunately, a solution for accomplishing this was presented by another user in the following thread:
http://forums.infragistics.com/forums/t/1237.aspx
There isn't, however, a "quick and easy" approach to doing this since you have to work with the Report object in order for it to publish to a format that the print preview will understand.