How to customize PDF document name from.NET MVC PDF Viewer?
Customize the caption label
The MetroForm CaptionLabel Forecolor can be changed when mouse hovering. It can be achieved by handling the MouseEnter and MouseLeave events in ASP.NET MVC PDF Viewer. The following code demonstrates the same.
C#
// Caption labels for(int i = 0; i < this.CaptionLabels.Count; i++) { CaptionLabel item = this.CaptionLabels[i]; item.LabelMouseEnter += new CaptionLabel.MouseEnter(item_LabelMouseEnter); item.LabelMouseLeave += new CaptionLabel.MouseLeave(item_LabelMouseLeave); item.LabelMouseDown += new CaptionLabel.MouseDown(item_LabelMouseDown); } /// <summary> /// Occurs on Mouse Pointer Leave /// </summary> void item_LabelMouseLeave(object sender, LabelMouseLeaveEventArgs e) { if((sender as CaptionLabel) != null) { (sender as CaptionLabel).ForeColor = Color.White; } } /// <summary> /// Occurs on Mouse Pointer Enter /// </summary> void item_LabelMouseEnter(object sender, LabelMouseEnterEventArgs e) { if((sender as CaptionLabel) != null) { (sender as CaptionLabel).ForeColor = Color.Yellow; } }
VB
' Caption labels For i As Integer = 0 To Me.CaptionLabels.Count - 1 Dim item As CaptionLabel = Me.CaptionLabels(i) AddHandler item.LabelMouseEnter, AddressOf item_LabelMouseEnter AddHandler item.LabelMouseLeave, AddressOf item_LabelMouseLeave AddHandler item.LabelMouseDown, AddressOf item_LabelMouseDown Next i ''' <summary> ''' Occurs on Mouse Pointer Leave ''' </summary> Private Sub item_LabelMouseLeave(ByVal sender As Object, ByVal e As LabelMouseLeaveEventArgs) If(TryCast(sender, CaptionLabel)) IsNot Nothing Then TryCast(sender, CaptionLabel).ForeColor = Color.White End If End Sub ''' <summary> ''' Occurs on Mouse Pointer Enter ''' </summary> Private Sub item_LabelMouseEnter(ByVal sender As Object, ByVal e As LabelMouseEnterEventArgs) If(TryCast(sender, CaptionLabel)) IsNot Nothing Then TryCast(sender, CaptionLabel).ForeColor = Color.Yellow End If End Sub
Screenshot
Samples:
C#: MetroFormExample
VB: MetroFormExample
Conclusion
I hope you enjoyed learning on how to customize PDF document name from ASP.NET MVC PDF Viewer.
You can refer to our ASP.NET MVC PDF Viewer feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC PDF Viewer example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!