Imports System.IO
Imports System.Data.SqlClient
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Diagnostics
Imports Bytescout.PDFExtractor
Public Class Form2
    ' Dim strPrint As String = ""
    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DatabaseICICIDataSet.ICICI_Master' table. You can move, or remove it, as needed.
        '  Me.ICICI_MasterTableAdapter.Fill(Me.DatabaseICICIDataSet.ICICI_Master)
        Me.ICICI_MasterTableAdapter.Fill(Me.DatabaseICICIDataSet.ICICI_Master)
        report1.SetDataSource(DatabaseICICIDataSet)
        CrystalReportViewer2.ReportSource = report1
        CrystalReportViewer2.Refresh()
    End Sub
    Private Sub ICICI_MasterBindingSource1BindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Validate()
        Me.ICICI_MasterBindingSource1.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DatabaseICICIDataSet)
    End Sub

    'Function exportfile() As Boolean
    '    '  ConfigureCrystalReports()
    '    Try
    '        Dim CrExportOptions As ExportOptions
    '        Dim CrDiskFileDestinationOptions As New  _
    '        DiskFileDestinationOptions()
    '        Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
    '        CrDiskFileDestinationOptions.DiskFileName = _
    '                                    "d:\Buffalo_Bill\" & Val(txtsrno.Text) & ".pdf"
    '        CrExportOptions = REReport.ExportOptions
    '        With CrExportOptions
    '            .ExportDestinationType = ExportDestinationType.DiskFile
    '            .ExportFormatType = ExportFormatType.PortableDocFormat
    '            .DestinationOptions = CrDiskFileDestinationOptions
    '            ' .FormatOptions = CrFormatTypeOptions
    '        End With
    '        REReport.Export()
    '    Catch ex As Exception
    '        MsgBox(ex.ToString)
    '    End Try
    'End Function

    Private Sub btnexpoy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexpoy.Click
        Dim str As String
        Dim myReportDocument As New ReportDocument
        Dim myExportOpts As New ExportOptions
        Dim diskOpts As DiskFileDestinationOptions
        diskOpts = ExportOptions.CreateDiskFileDestinationOptions
        myExportOpts.ExportFormatType = _
        ExportFormatType.PortableDocFormat

        myExportOpts.ExportDestinationType = _
        ExportDestinationType.DiskFile
        diskOpts.DiskFileName = str
        myExportOpts.ExportDestinationOptions = diskOpts
        myReportDocument.Export(myExportOpts)
        '  ConfigureCrystalReports()
        Dim REReport As ReportDocument
        Try
            Dim CrExportOptions As ExportOptions
            Dim CrDiskFileDestinationOptions As New  _
            DiskFileDestinationOptions()
            Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
            CrDiskFileDestinationOptions.DiskFileName = _
                                           "d:\salman\" & 1 & ".txt"
            CrExportOptions = myReportDocument.ExportOptions
            With CrExportOptions
                .ExportDestinationType = ExportDestinationType.DiskFile
                .ExportFormatType = ExportFormatType.PortableDocFormat
                .DestinationOptions = CrDiskFileDestinationOptions
                ' .FormatOptions = CrFormatTypeOptions
            End With
            myReportDocument.Export()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try


    End Sub

    Function pdf(ByVal str As String()) As LoadSaveReportException
        ' Create Bytescout.PDFExtractor.TextExtractor instance
        Dim extractor As New TextExtractor()
        extractor.RegistrationName = "demo"
        extractor.RegistrationKey = "demo"

        ' Load sample PDF document
        extractor.LoadDocumentFromFile("sample2.pdf")

        ' Save extracted text to file
        extractor.SaveTextToFile("output.txt")

        ' Open output file in default associated application
        System.Diagnostics.Process.Start("output.txt")

        Return extractor("output.txt")
    End Function

End Class
This article has been dead for over six months. Start a new discussion instead.