4 Answers, 1 is accepted
Thank you for writing.
To do that you should utilize the RadPrintDocument API:
RadPrintDocument doc =
new
RadPrintDocument();
doc.Margins.Left = 200;
radGridView1.PrintPreview(doc);
radGridView1.Print(
false
, doc);
More information on the matter is available here: http://docs.telerik.com/devtools/winforms/telerik-presentation-framework/printing-support/radprintdocument/radprintdocument
I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.
Regards,
Stefan
Telerik
Hi guys,
I've used bellow code for setting paper size and margin for printing the content in Radrichtexteditor. Actually for this purpose i've applied Radprintdocument. But the margin dosen't work
please help me about this problem
my code is here;
private void PrintA4_Click(object sender, EventArgs e)
{
PaperSize ps = new PaperSize(); ps.RawKind = (int)PaperKind.A4; radPrintDocument1.DefaultPageSettings.PaperSize = ps; radPrintDocument1.DefaultPageSettings.Landscape = false; //radPrintDocument1.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(10, 10, 10, 10); radPrintDocument1.Margins.Left = 0; radPrintDocument1.Maregins.Top = 0; radPrintDocument1.Print(); }
Thank you for writing.
In order to change the margins of a printed document from RadRichTextEditor, you need to set them on the loaded document. The behavior is similar to the one in Word. While investigating the described scenario I managed to isolate an issue. The incorrect behavior is related to the editor not applying the margins set to the RadPrintDocument instance.
I have logged the issue in our feedback portal. I have also added a vote for it on your behalf, here: FIX. RadRichTextEditor - the printing engine does not respect the margins set on the RadPrintDocument. You can additionally subscribe to the item and be updated with all of its status changes. I have also updated your Telerik points.
Until we permanently resolve the issue you need to explicitly apply the margins on the document loaded in the editor. Please check my code snippet below:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
RadPrintDocument doc =
new
RadPrintDocument();
this
.radRichTextEditor1.Document.SectionDefaultPageMargin =
new
Telerik.WinForms.Documents.Layout.Padding(0, 0, 10, 10);
doc.AssociatedObject =
this
.radRichTextEditor1;
RadPrintPreviewDialog dialog =
new
RadPrintPreviewDialog();
dialog.Document = doc;
dialog.ShowDialog();
}
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo
Telerik by Progress