The function below will do what you want, you'll need to adjust it a bit tho (had to translate some variables) and some things might not be needed for you (setting params / reconnecting ) but I'm sure you'll be able to adjust it to your needs.
Public Shared Sub PrintToPDF(ByVal Reportname As String, ByVal params As List(Of ReportParameters), Optional ByVal path As String = "")
Try
Dim rpt As New ReportDocument
If Reportnaam.EndsWith(".rpt") Then Reportnaam = Reportnaam.Replace(".rpt", "")
Dim file As String =
If IO.File.Exists(file) = False Then
Exit Sub
End If
rpt.Load(file)
rpt = reconnectreport(rpt)
If params IsNot Nothing AndAlso params.Count > 0 Then
For Each c As ReportParameters In params
rpt.SetParameterValue(c.ParamNaam, c.ParamValue)
Next
End If
If String.IsNullOrEmpty(path) Then
Dim ofd As New SaveFileDialog
ofd.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
ofd.Filter = ".pdf|PDF"
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim path As String = ofd.FileName
If path.EndsWith(".pdf") = False Then path &= ".pdf"
pad = path
End If
End If
If Not String.IsNullOrEmpty(pad) Then
rpt.ExportToDisk(ExportFormatType.PortableDocFormat, pad)
End If
Catch ex As Exception
JoroLogging.AddLog(ex, GetCurrentMethod.DeclaringType.Name, GetCurrentMethod.Name)
End Try
End Sub