#1
  1. llama slayer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    464
    Rep Power
    16

    sending information from pdf file into mysql db


    I was wondering if there was a way to do this without using something like pdflib...been looking around the forum topics and saw alot of things on creating pdf files, and third party tools to convert pdf to html/text, however, tools like that are out of the question due to quality issues. I haven't played around with it much, but I was thinking along the lines of something like fopen() and fread() to get the file contents and then put the elements into an array, from which I can then use to submit into a database...any thoughts on this or anyone who has done this before? thanks!
    "So I hired the best Feng-Shui artist to come down here and get my yin and yang in order, cause I...FRICK'N...LOVE...HARMONY!!!"
    - Captain Murphey, Sealab 2021
  2. #2
  3. No Profile Picture
    I am me
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2004
    Location
    Earth
    Posts
    560
    Rep Power
    11
    I don't think its as simple as reading each line of the pdf file. I think pdf files use an x/y coordinate system to place the text and ojects in the file.

    Create a simple script that tries to read a line from a pdf file and see if it works. I don't think it will.

    Comments on this post

    • h4x0r agrees
  4. #3
  5. llama slayer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    464
    Rep Power
    16
    that thought had crossed my mind and I wondered how php might handle it...I was thinking that what might happen is if there is something like 3 collumns of text like this:

    . ______
    1|A|B|C|
    2|_|_|_|
    3|_|_|_|
    4|_|_|_|

    that it might create an array which looked like:
    [0] => A1
    [1] => A2
    [2] => A3
    [3] => A4
    [4] => B1
    [5] => B2
    ...
    [11] => C4

    or something like:
    [0] => ABC1
    [1] => ABC2
    [2] => ABC3
    [3] => ABC4

    I would think that it might be possible to figure out the formula for where the data gets put after being pulled from the pdf and use that to grab what I need for the database...going to try and play around with it soon, but lunch and work are calling me at the moment
    "So I hired the best Feng-Shui artist to come down here and get my yin and yang in order, cause I...FRICK'N...LOVE...HARMONY!!!"
    - Captain Murphey, Sealab 2021
  6. #4
  7. llama slayer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    464
    Rep Power
    16
    ok, well here's what I used:
    PHP Code:
    $filename "test.pdf";
    $openfile fopen($filename"r");
    $filecontents fread($openfilefilesize($filename));
    fclose($openfile);
    print_r($filecontents); 
    and it returned a bunch of garbage like:
    Code:
    %PDF-1.3 %쏢 8 0 obj <> stream x]keUy0 anga`/(2 */h 6JX%mjQZ/*C[icc/զi$h5)M5bj }Ιy~k3Gcguz{AOux_;2)dٿuxrjrkaPUe&QTL0|rڕ:"Ȋ4O?ڵ+O>ʃHrhs(*,?:U>:*yq< (_+"`*_J[`m-u4 wY ևg-*qyʋelKOEXmGgˍ3n?
    this isn't a problem with the method I'm using to do this, right? I mean, is there no way to 'decode' or 'decrypt' what's returned? Cause I at least expected to see evident of an array since I thought that fread() put everything into an array?
    "So I hired the best Feng-Shui artist to come down here and get my yin and yang in order, cause I...FRICK'N...LOVE...HARMONY!!!"
    - Captain Murphey, Sealab 2021
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    1
    Rep Power
    0

    Post convert pdf file to mysql db


    Hi,
    I try to search php code to convert pdf file to mysql db.
    Could it be done in php?


    I really need help for this..

    TQ

IMN logo majestic logo threadwatch logo seochat tools logo