Results 1 to 7 of 7

Thread: Text searching

  1. #1
    Join Date
    Apr 2007
    Location
    KL
    Posts
    20
    Rep Power
    0

    Text searching

    im newbie here.. nak tanya pada pakar2 yg ade kat sini..
    sekarang ni saya guna ASP..

    saya nak cari perkataan dalam pdf file, guna ASP.. how to do? saya tengah download PDF SDK.. tp x tau la betul ke step saya ni..

    contoh: bila taip "hello", system akan baca text dlm pdf dan show pdf file mana yang ade "hello"

    urgent ni..plz help..tq (sorry kalau issue ni dah dipost sblm ni)

  2. #2
    Join Date
    Apr 2007
    Location
    KL
    Posts
    20
    Rep Power
    0
    memandangkan tiada sape reply, biar aku reply sendiri..haha

    dapat satu solution.. download converter nyer DLL ..meaning convert pdf tu ke text, then wat serching..
    prob is, dll ni kena beli plak.. skrg try trial dia..tengah cari free nye..
    or korang2 yg lain ade cara lain..juz shoot!

  3. #3
    Join Date
    Jun 2001
    Location
    Mystic Kingdoms
    Posts
    2,749
    Rep Power
    272
    1 - susah nak jumpa pakar2 ASP.
    2 - soalan anda agak sukar difahami.
    3 - banyak orang kerja dalam enviroment php + mysql yang mmg biasa dengan baca pdf.
    4 - jarang2 orang nak buat asp baca pdf.

    Anyway, thank for sharing. mungkin ada orang lain mencuba benda ni.

  4. #4
    Join Date
    Aug 2006
    Location
    Malaysia
    Posts
    1,576
    Rep Power
    185
    Quote Originally Posted by Chubby21 View Post
    im newbie here.. nak tanya pada pakar2 yg ade kat sini..
    sekarang ni saya guna ASP..

    saya nak cari perkataan dalam pdf file, guna ASP.. how to do? saya tengah download PDF SDK.. tp x tau la betul ke step saya ni..

    contoh: bila taip "hello", system akan baca text dlm pdf dan show pdf file mana yang ade "hello"

    urgent ni..plz help..tq (sorry kalau issue ni dah dipost sblm ni)
    If the Acrobat reader is installed, when pdf is opened via the web browser, the is a mini toolbar provided by the Acrobat reader that has a search capability. For example, to search "hello" by typing "hello" as a search string, it will highlight all locations of "hello".

  5. #5
    Join Date
    Apr 2007
    Location
    KL
    Posts
    20
    Rep Power
    0
    Quote Originally Posted by genzy View Post
    If the Acrobat reader is installed, when pdf is opened via the web browser, the is a mini toolbar provided by the Acrobat reader that has a search capability. For example, to search "hello" by typing "hello" as a search string, it will highlight all locations of "hello".
    firstly, thanks pada sapa2 yang jawab..

    senario is, im trying to develop some kind of knowledge base..ala-ala la..hehe. so when user key in 'hello', wat happen is system will open all find that stored in one specific path ..like C:\\my doc..then the system will read n search that 'hello'..

    so en.Genzy, wat do u mean if the acrobat reader is installed? and i dont actually open the pdf file in web browser?..can xplain a bit?

    tq..

  6. #6
    Join Date
    Apr 2007
    Location
    KL
    Posts
    20
    Rep Power
    0
    akhirnya, solution nye, beli dll yang lain...
    yang ni x payah extract dulu pdf tu, terus je wat searching..
    tp harga dia x tau..hehe

  7. #7
    Join Date
    Aug 2006
    Location
    Malaysia
    Posts
    1,576
    Rep Power
    185
    For References:

    Unable To Access Objects In Visual Basic
    Code:
    Dim avdoc as Object, app as object, pddoc as Object
    set app = CreateObject("AcroExch.App")
    set avdoc = CreateObject("AcroExch.AVDoc")
    avdoc.open "c:\test.pdf", "Temp Title"
    
    if (avdoc.IsValid = True) Then
    set pddoc = avdoc.GetPDDoc()
    End If
    Automation of Acrobat with VBA - dBforums
    Code:
    I use this class to merge PDF files using Acrobat be sure to set a reference to "Adobe Acrobat x.x Type Library"
    
    '---------------- START CODE --------------------------------------------------------
    Option Compare Database
    Option Explicit
    
    Private colDOCS As Collection 'PDF Files to merge
    Private strDestination As String 'Destination PDF Doc.
    Private bolDeleteCoverPage As Boolean
    
    Sub AddFile(strNewData As String)
    colDOCS.ADD strNewData
    End Sub
    
    Sub ClearFileList()
    'PURPOSE: remove Files in Collection. Set Collection to nothing and reinitalize
    If Not colDOCS Is Nothing Then Set colDOCS = Nothing
    Set colDOCS = New Collection
    End Sub
    
    Property Let Destination(strDest As String)
    strDestination = strDest
    End Property
    
    Function Merge() As Long
    On Error GoTo Proc_Error
    Dim objAcroApp As Acrobat.CAcroApp
    Dim objAcroDoc As Acrobat.CAcroPDDoc
    Dim objAcroDocSrc As Acrobat.CAcroPDDoc
    Dim lngRetVal As Long
    Dim I As Long
    Dim lngPage As Long
    
    Set objAcroApp = CreateObject("AcroExch.App")
    Set objAcroDoc = CreateObject("AcroExch.PDDoc")
    Set objAcroDocSrc = CreateObject("AcroExch.PDDoc")
    
    lngRetVal = objAcroDoc.Open(colDOCS.Item(1))
    lngPage = objAcroDoc.GetNumPages
    
    For I = 2 To colDOCS.Count
    lngRetVal = objAcroDocSrc.Open(colDOCS.Item(I))
    If lngRetVal = False Then
    MsgBox ("Error Opening " + colDOCS.Item(I))
    Merge = False
    GoTo Proc_Exit
    End If
    Merge = objAcroDoc.InsertPages((lngPage - 1), objAcroDocSrc, 0, objAcroDocSrc.GetNumPages, False)
    lngPage = lngPage + objAcroDocSrc.GetNumPages
    objAcroDocSrc.Close
    Next I
    objAcroDoc.CreateThumbs 0, lngPage - 1
    
    Merge = objAcroDoc.Save(PDSaveFull, strDestination)
    
    objAcroDoc.Close
    objAcroApp.Exit
    Proc_Exit:
    
    If Not objAcroApp Is Nothing Then Set objAcroApp = Nothing
    If Not objAcroDoc Is Nothing Then Set objAcroDoc = Nothing
    If Not objAcroDocSrc Is Nothing Then Set objAcroDocSrc = Nothing
    Exit Function
    Proc_Error:
    MsgBox Err.Description
    Merge = Err.Number
    Resume Proc_Exit
    End Function
    
    Private Sub Class_Initialize()
    Set colDOCS = New Collection
    End Sub
    Private Sub Class_Terminate()
    On Error Resume Next
    If Not colDOCS Is Nothing Then Set colDOCS = Nothing
    End Sub
    Use the code provided above. The key is that it uses a collection to contain the list of files you want to combine.

    So, your fist step is to clear the collection.
    You then add the file-names (full path) to the collection.
    You then specify a destination file name.
    Finally you call merge.
    To be tidy, you probably should clear the collection when you're done.

    Assuming you had 3 pdfs with the names test1-3 in c:\pdftest, you could use this procedure to merge them.

    Sub test()
    ClearFileList
    Destination = "c:\pdftest\foo.pdf"
    AddFile "C:\pdftest\test1.pdf"
    AddFile "C:\pdftest\test2.pdf"
    AddFile "C:\pdftest\test3.pdf"
    Merge
    End Sub

    And thank you, to Jose for an excellent bit of code.
    Adobe Acrobat automation with VB and Windows API
    Code:
        
    ' Declaration
        Structure Rect
            Dim Left As Integer
            Dim Top As Integer
            Dim Right As Integer
            Dim Bottom As Integer
        End Structure
    
        Declare Function GetWindow Lib "user32" (ByVal hwnd As Integer, ByVal wCmd As Integer) As Integer
        Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, _
            ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
        Declare Function GetClientRect Lib "user32" (ByVal hwnd As Integer, ByRef lpRect As Rect) As Integer
        Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
        Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer
        Private Declare Function GetWindowRect Lib "user32" (ByVal Hwnd As Integer, ByRef lpRect As Form1.Rect) As Integer
        Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Integer) As Integer
        Private Declare Function MoveWindow Lib "user32" (ByVal Hwnd As Integer, ByVal x As Integer, ByVal y As Integer, _
            ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bRepaint As Integer) As Integer
    
        Private AcroHandle As Integer
        Private AcroXApp As Acrobat.CAcroApp
        Private AcroXAVDoc As Acrobat.CAcroAVDoc
        Private AcroXPDDoc As Acrobat.CAcroPDDoc
        Private FormApp As AFORMAUTLib.AFormApp
        Private AcroForm As AFORMAUTLib.Fields
        Private Field As AFORMAUTLib.Field
    
    ' Methods
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    
            Dim FileName As String
            AcroXApp = CType(CreateObject("AcroExch.App"), Acrobat.CAcroApp)
            'Removing toolbar buttons from the user interface
            With AcroXApp
                .ToolButtonRemove("Save")
                .ToolButtonRemove("Open")
                .ToolButtonRemove("AcroForm:WidgetTool")
            End With
            AcroXAVDoc = CType(CreateObject("AcroExch.AVDoc"), Acrobat.CAcroAVDoc)
            FileName = "C:\'Your path and pdf file name'"
            AcroXAVDoc.Open(FileName, "Acrobat")
            AcroHandle = FindWindow(vbNullString, "Adobe Acrobat Professional - [Acrobat]")
            SetParent(AcroHandle, Panel1.Handle.ToInt32) 'put Acrobat in winform panel.  The panel is docked to all four sides of the form.  In VB6 you need to resize the panel with the form
            'Show in winform (not in a panel) alternative to above:
            'AcroXAVDoc.OpenInWindowEx(FileName, Me.Panel1.Handle.ToInt32, 1, 1, 0, 0, 2, 0, 0, 0)
            'I've found this is not as flexible
            'The following is to fill Acrobat fields with data
            AcroXPDDoc = CType(AcroXAVDoc.GetPDDoc, Acrobat.CAcroPDDoc)
            FormApp = CType(CreateObject("AFormAut.App"), AFORMAUTLib.AFormApp)
            AcroForm = CType(FormApp.Fields, AFORMAUTLib.Fields)
            For Each Field In AcroForm
                Field.Value = "This is a test of how well this works, and if I have this right, I can be happy."
            Next
            AcroXPDDoc.ClearFlags(&H1) 'Keep Acrobat from querying a file save when component closes
            SetAcroSize(AcroHandle, Panel1)
            AcroXApp.Show()
    
        End Sub
    
        Private Sub SetAcroSize(ByRef lngHwnd As Integer, ByRef AcroPanel As System.Windows.Forms.Panel)
    
            'Hide the title bar and menus from the user
            'and resize Acrobat with the resizing of the form
            Dim lngX As Integer 'acro left position
            Dim lngY As Integer 'acro top position
            Dim lngW As Integer 'acro width
            Dim lngH As Integer 'acro height
            Dim AppRect As Form1.Rect
            GetWindowRect(AcroPanel.Handle.ToInt32, AppRect)
            lngX = -GetSystemMetrics(32)
            lngY = -GetSystemMetrics(33) - 37
            lngW = AppRect.Right - AppRect.Left - lngX * 2
            lngH = AppRect.Bottom - AppRect.Top - lngY * 2 - 37
            MoveWindow(lngHwnd, lngX, lngY, lngW, lngH, 1)
    
        End Sub
    
        Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    
            SetAcroSize(AcroHandle, Panel1)
    
        End Sub
    
        Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
    
            'If acrobat is not properly closed, you end up with the acrobat.exe process continuing to run, 
            'but Acrobat will not be visible.  This will baffle you to no end until you "end process" 
            'with Windows task manager while testing your app.
            AcroXApp.Hide()
            SetParent(AcroHandle, 0)
            AcroXAVDoc.Close(0)
            AcroXApp.CloseAllDocs()
            AcroXApp.Exit()
    
        End Sub
    Is there a way to automate pdf/email process - ITtoolbox Groups
    Code:
    Private Sub Command1_Click()
    'Declare acrobat objects and other variables
    Dim gApp As Object    'Acrobat.CAcroApp
    Dim AcroExchAVDoc As Object    'CAcroAVDoc
    Dim AVPage As Object         'CAcroAVPageView
    Dim bOK, bFound As Boolean
    Dim i As Long, lngPage As Long
    Dim lngAnswer As Long
    
    'Create the Acrobat objects.
    Set gApp = CreateObject("AcroExch.App")
    Set AcroExchAVDoc = CreateObject("AcroExch.AVDoc")
    gApp.Show
    
    bOK = AcroExchAVDoc.Open("C:\My Documents\MyPDFs\STRUTS.pdf", "")
    
    If (bOK) Then
    bFound = AcroExchAVDoc.FindText("Reinstall", True, True, True)
    If (bFound) Then
    Set AVPage = AcroExchAVDoc.GetAVPageView
    lngPage = AVPage.GetPageNum
    MsgBox ("Text found on this Page: " & (lngPage + 1))
    Set AVPage = Nothing
    End If
    Else
    lngAnswer = MsgBox("Text Not Found!!!", vbCritical, "Text Not Found")
    End If
    Stop
    AcroExchAVDoc.ClearSelection
    AcroExchAVDoc.Close 1
    Set AcroExchAVDoc = Nothing
    
    'Quit Acrobat.
    gApp.Exit
    End Sub

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. searching for mentor/job
    By shunkhai in forum Mamak Stall
    Replies: 6
    Last Post: 03-09-2008, 07:41 PM
  2. ASp-searching
    By cloudy in forum Website Programming
    Replies: 2
    Last Post: 23-05-2007, 08:59 AM
  3. searching for asp.net project
    By lighching in forum Other Webmaster-related Services and Promotion
    Replies: 2
    Last Post: 05-08-2005, 01:31 PM
  4. Searching for JOBS?
    By JobListed in forum Websites Review and Suggestion
    Replies: 0
    Last Post: 17-05-2005, 04:58 PM
  5. searching.....
    By nurulmajdi in forum Website Programming
    Replies: 1
    Last Post: 01-03-2004, 06:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37