Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.  
  3. Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
  4.  
  5. rpt.Load(Server.MapPath("~/admin/PlaReport.rpt"))
  6. rpt.SetDatabaseLogon("sa", "admin123#", "Sheldon", "Sales")
  7. rpt.SetParameterValue("@Date", 0)
  8.  
  9. Dim pDoc As System.Drawing.Printing.PrintDocument = New System.Drawing.Printing.PrintDocument
  10. Dim PrintLayout As CrystalDecisions.Shared.PrintLayoutSettings = New CrystalDecisions.Shared.PrintLayoutSettings
  11. Dim printerSettings As System.Drawing.Printing.PrinterSettings = New System.Drawing.Printing.PrinterSettings
  12.  
  13. printerSettings.PrinterName = "\KOOTHRAPPALIReception"
  14.  
  15. Dim pSettings As System.Drawing.Printing.PageSettings = New System.Drawing.Printing.PageSettings(printerSettings)
  16. printerSettings.DefaultPageSettings.Landscape = False
  17. printerSettings.Copies = 1
  18. Dim pkSource As PaperSource
  19. For i = 0 To printerSettings.PaperSources.Count - 1
  20. pkSource = printerSettings.PaperSources.Item(i)
  21. If pkSource.SourceName = "Large Capacity Cassette" Then
  22. pSettings.PaperSource = pkSource
  23. End If
  24. Next
  25.  
  26. rpt.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True
  27. rpt.PrintOptions.PrinterDuplex = CrystalDecisions.Shared.PrinterDuplex.Simplex
  28. rpt.PrintToPrinter(printerSettings, pSettings, False, PrintLayout)
  29.  
  30. MessageBox.Show("Done")
  31.  
  32. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement