Have code using ExportToPdf to export my sfDatagrid. It refuses to orient in landscape mode. If I use PDFDocument, it will however the only way to add header text is to use the ExportToPdf. Any advice? I am on the la
Here is my code:
Try
If dtBenRickPrint.Rows.Count > 0 Then
Try
Dim options As New PdfExportingOptions()
AddHandler options.HeaderFooterExporting, AddressOf options_HeaderFooterExporting
Dim document = Me.SfDataGrid1.ExportToPdf(options)
' Set the page size explicitly to landscape
document.PageSettings.Orientation = PdfPageOrientation.Landscape
SaveFileDialog1.Filter = "PDF Files (*.pdf)|*.pdf"
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
document.Save(SaveFileDialog1.FileName)
End If
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
End Try
Else
MsgBox("Please refresh the report before printing.")
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Sub options_HeaderFooterExporting(ByVal sender As Object, ByVal e As PdfHeaderFooterEventArgs)
' Add your custom header/footer content here if needed
End Sub