[ steve585 @ 29.04.2008. 19:57 ] @
Elem, vec neko vrijeme razmisljam o izradi programa za prebacivanje sadrzaja pdf dokumenta u excel.

Jedini problemcic je sto nemam blage veze kako to napraviti :-)

Da li je moguce pdf dokumente citati kao npr. tekst file-ove? Ako jeste onda nema prevelikih problema za izradu aplikacije. Trazio sam malo po net-u ima li gdje primjer rada sa pdf fajlovima, ali bez nekog uspjeha.

Ako itko ima nekih saznanja o radu sa pdf file-ovima dobro ce doci.

[ Aleksandar Vasic @ 29.04.2008. 20:26 ] @
pa ti u stvari samo treba da uchitash pdf u program i onda da ga rasporedjujes u excel

pogledaj na pscode primere citanja pdf-a
[ rgdrajko @ 30.04.2008. 16:08 ] @
Ako zelis da pdf prebacis direktno u Excel onda moras da koristis program za opticko prepoznavanje teksta(OCR) kao sto je npr. "ABBYY FineReader 9.0 Professional Edition" koji moze da ucitava razne tipove slika(TIF, JPG, BMP...) i pdf fajlova i nakon obrade ce skoro 100% prepoznati tekst sa slike(zavisi od rezolucije skenirane slike) i onda ce u skoro istom formatu kao i na originalnoj slici ili pdf fajlu taj tekst prebaciti u Word, Excel...

[Ovu poruku je menjao rgdrajko dana 30.04.2008. u 21:44 GMT+1]
[ steve585 @ 30.04.2008. 21:44 ] @
Dakle u skladu sa Aleksandrovim savjetom na preporucenom sajtu pronasao sam jedan primjer koji iscitava sadrzaj pdf file u text box, sto je sasvim prihvatljivo, jer poslije cu vec nekako prebaciti podatke u excel.

Jedina mana ovog programa je da zahtjeva instalaciju Adobe Acrobat-a na PC korisnika, sto nije najsretnije rjesenje buduci da je za isti potrebno platiti licencu.

Da li je moguce koristiti neko free rjesenje za iscitavanje podataka?

Da li je u skladu sa pravilnikom da napravim upload code-a koji sam download-ovo?
[ Aleksandar Vasic @ 30.04.2008. 21:48 ] @
Acrobat Reader nije besplatan?? Otkad to??

Svoj Source Code je dozvoljen, a ukoliko je tuđi moraš da naznačuš či je...


Edit: Možda su novije verzije, kolko se ja sećam do početka 8. je bilo besplatno
[ steve585 @ 30.04.2008. 21:54 ] @
Nije Reader u pitanju:
Citiram autora:
You must have Adobe Acrobat NOT the reader. the reader will not work.


[ steve585 @ 30.04.2008. 21:58 ] @
Evo i Code-a iz navedenog programcica. Autor navedenog code-a je potpisan kao gandu

Code:

Option Explicit

Private myPDF As Object
Private myPDFPage As Object
Private myPageHilite As Object
Private pageSelect As Object
    
Private pdfData As String
Private myPDFPageCount As Object
Private openResult As Boolean
Private closeResult As Boolean
Private hiliteResult As Boolean
Private pageCount As Integer

Private filelocation As String
Private pagenumber As Integer

Private Sub cmdGetFile_Click()
    
    'open the commondialog control
    CommonDialog1.ShowOpen
    
    'puts the filename selected inot the text box
    txtFileName.Text = CommonDialog1.FileName
End Sub


Private Sub cmdGetText_Click()
    
    'clean up
    txtPDFText.Text = ""
    pdfData = ""
    Label2.Caption = ""
    
    getBodyTextPDF
    txtPDFText.Text = pdfData
    
    MsgBox "Finished ; )", vbInformation, "PDF Text Data"
End Sub

Private Sub getBodyTextPDF()

    'instantiate the adobe object that we are going to use
    'we are using this object b/c this is the only object i
    'could find that had a function that returned the number of
    'pages in a prf file.  the number of pages is important later on
    
    Set myPDFPageCount = CreateObject("acroexch.pddoc")
    
    
    'when we open the file it will return true/false

    filelocation = txtFileName.Text
    openResult = myPDFPageCount.Open(filelocation)
    
    'little but of error handling, if we cannot open the file properly
    If openResult = False Then
        Set myPDFPageCount = Nothing
        MsgBox "Error opening file"
        Exit Sub
    End If
    
    'get the number of pages
    pageCount = myPDFPageCount.GetNumPages
    
    'when we close the file it will return truw/false
    closeResult = myPDFPageCount.Close
    
    'little but of error handling, if we cannot open the file properly
    If closeResult = False Then
        Set myPDFPageCount = Nothing
        MsgBox "Error closing file"
        Exit Sub
    End If

    'destroy the object we do not need it anymore
    Set myPDFPageCount = Nothing
    
    'i could only figure out how to get text from one page at a time
    'so i decided to run a loop that would get the text from a file
    'one page at a time. (adobe counts the first page)


    'instantiate object that we are going to use to get the text
    Set myPDF = CreateObject("acroexch.pddoc")
    
    'once again open the file
    openResult = myPDF.Open(filelocation)


    For pagenumber = 0 To pageCount - 1
        DoEvents
        getPDFTextFromPage pagenumber
        Label2.Caption = "Extracting : " & pagenumber + 1 & " of " & pageCount
    Next
    
    Set myPDF = Nothing

End Sub

Private Sub getPDFTextFromPage(pagenumber As Integer)

    'create pdf page object, with a specified page
    Set myPDFPage = myPDF.AcquirePage(pagenumber)

    'create a hilite object, this hilite object is what we will use to extract
    'the text, if you can hilite text then you can pull it out of the pdf file.
    Set myPageHilite = CreateObject("acroexch.hilitelist")
    
    'returns true/false, we are setting the parameters of the hilite object,
    'we are telling the hilite object that when you are called hilite the
    'entire page (0-9000)
    hiliteResult = myPageHilite.Add(0, 9000)

    'we are now going to hilite the page specified
    Set pageSelect = myPDFPage.CreatePageHilite(myPageHilite)
    
    'when pdf hilites it breaks up the page into little pieces so when we try
    'to extract that data from the hilite we ger it in little chuncks so have to loop
    'the data togther and append it together.
    
    'we can also use the same string  (pdfData to append all the pages together)
    Dim i As Integer
    For i = 0 To pageSelect.GetNumText - 1
        DoEvents
        pdfData = pdfData & pageSelect.GetText(i)
    Next

    'clean up

    Set myPDFPage = Nothing
    Set myPageHilite = Nothing
    Set pageSelect = Nothing
    
End Sub

Private Sub Form_Load()
    Label2.Caption = ""
End Sub


Navedeni kod preuzet je sa:
http://www.planet-source-code....ForceRefresh=43020081654368207
[ Aleksandar Vasic @ 30.04.2008. 22:01 ] @
mozda adobe acrobat creator on se placa...

Dodaj na dnu ovog koda da su delovi koda preuzeti sa....
[ rgdrajko @ 30.04.2008. 22:11 ] @
Umesto Adobe Acrobat-a imas Foxit Reader, kraci je brzi i bolji.
Mozes ga skinuti sa:

http://www.filehippo.com/download_foxit/
[ steve585 @ 30.04.2008. 22:12 ] @
Bice da
Code:

acroexch.hilitelist 

vrsi prebacivanje sadrzaja pdf file-a u tekst oblik. Ispravite me ako grijesim. Pogledati cu na net-u koja mu je uloga.
[ steve585 @ 30.04.2008. 22:22 ] @
rgdrajko ideja na mjestu. Sad jos treba vidjeti kako funkcije tog free programa uklopiti u postojeci kod.
[ rgdrajko @ 30.04.2008. 23:33 ] @
Evo ti primer iz vb.net-a, ucitavanja pdf fajla preko acrobat readera, mozda ti pomogne.

Code:
Imports System.Runtime.InteropServices
Public Class Form1
    <DllImport("User32.dll")> _
    Private Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
    End Function
    Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer

    Private Const WM_SYSCOMMAND As Integer = 274
    Private Const SC_MAXIMIZE As Integer = 61488

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim proc As Process
        proc = Process.Start("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe")

        proc.WaitForInputIdle()

        SetParent(proc.MainWindowHandle, Me.PictureBox1.Handle) ' e.g. Me.Handle, Me.RichTextBox1.Handle, etc.

        SendMessage(proc.MainWindowHandle, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
    End Sub
End Class
[ 3okc @ 01.05.2008. 07:56 ] @
Možda nije neophodan Acrobat, znam sigurno /isprobano/ da TotalCommander ima plug-in za čitanje pdf-a preko svog listera. Zahteva se "samo" instalacija GHOSTSCRIPT-a ali ona se, koliko znam, ne plaća.
[ steve585 @ 01.05.2008. 08:50 ] @
@rgdrajko
Nismo na istoj valnoj duzini. Ovaj kod koji si postovao vrsi ucitavanje pdf Reader-a (Adobe ili neki drugi ovisno o zeljama). Ono sto je moja zelja je iscitavanje sadrzaja pdf file-a i daljnja manipulacija iscitanih podtaka (prebacivanje u excel, word...). Kod koji sam post-ovao vrsi iscitavanje sadrzaja pdf file-a u text box i to je u biti ono sto zelim postici, ali na nacin da se koriste besplatni alati :-)