This is a migrated thread and some comments may be shown as answers.

printable panel and radprintdocument

1 Answer 158 Views
Panel
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 18 Jun 2015, 01:36 PM
(I posted this in general discussion, but I think that was wrong place).  Issue: I had no trouble creating a printable panel control using the documentation provided.  However if I add header and footer height and text to the radprintdocument in the control, the panel is printed overtop of the header.  How can I change so this doesn't happen?  (code for print preview of printable panel pnlCashReceiptsSummary and of custom control below)  Code I'm using for print preview:Dim doc As New RadPrintDocument()
doc.DefaultPageSettings.Landscape = True

doc.HeaderHeight = 100
doc.HeaderFont = New Font("Arial", 14, FontStyle.Bold)
doc.RightHeader = "AAAA"
doc.LeftHeader = "[Date Printed]"
doc.FooterHeight = 100
doc.FooterFont = New Font("Arial", 12)
doc.LeftFooter = GlobalVariables.CurrentDealer.Dealer_Fxd.DealerCode pnlCashReceiptsSummary.PrintPreview(doc) My Control :   Imports Telerik.WinControls.UI
Imports System.Drawing.Printing

Public Class PrintablePanel
Inherits RadPanel
Implements IPrintable


Public Function BeginPrint(sender As RadPrintDocument, args As PrintEventArgs) As Integer Implements IPrintable.BeginPrint

Return 1
End Function

Public Function EndPrint(sender As RadPrintDocument, args As PrintEventArgs) As Boolean Implements IPrintable.EndPrint
Return True
End Function

Public Function GetSettingsDialog(document As RadPrintDocument) As Form Implements IPrintable.GetSettingsDialog
Return New PrintSettingsDialog(document)
End Function

Public Function PrintPage(pageNumber As Integer, sender As RadPrintDocument, args As PrintPageEventArgs) As Boolean Implements IPrintable.PrintPage
Dim bmp As New Bitmap(Me.Width, Me.Height)
Me.DrawToBitmap(bmp, New Rectangle(Point.Empty, Me.Size))
args.Graphics.DrawImage(bmp, Point.Empty)
Return False
End Function

Public Sub Print(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
doc.Print()
End Sub

Public Sub PrintPreview(ByVal doc As RadPrintDocument)
doc.AssociatedObject = Me
Dim dialog As New RadPrintPreviewDialog(doc)
dialog.ThemeName = Me.ThemeName
dialog.ShowDialog()
End Sub

Private Function CreatePrintDocument() As RadPrintDocument
Dim doc As New RadPrintDocument()
doc.AssociatedObject = Me
Return doc
End Function
End Class

1 Answer, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 18 Jun 2015, 03:29 PM

This has been resolved in another post:  http://www.telerik.com/forums/printable-panel-header-and-footer

Thanks!

Tags
Panel
Asked by
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Share this question
or