Thursday, 5 September 2013

How to parse PDF2JSON file in PHP

How to parse PDF2JSON file in PHP

Using PHP, how can I grab each the values from "text" tag?
This is my json file:
[{"number":1,"pages":33,"height":1188,"width":918,"fonts":[],
"text":[[108,108,23,21,2,"Some Text 1"],[108,131,6,21,2,"Some Text
2.."],[108,154,6,21,2,"Some Text 3.. "]]}]
And this is my PHP so far,
$data = json_decode(file_get_contents('file.json'));
$object = array();
foreach($data as $index=>$object) {
foreach($object as $name=>$value) {
//$output[$name][$index] = $value;
echo $output[text][0];
// .........
echo $output[text][5];
}
}
Thanks

No comments:

Post a Comment