Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > PDF
PDF Forum d'entraide sur la gestion dynamique de documents PDF avec PHP. Exemples : PDFLib, eZPdf, PhpToPdf... Avant de poster -> FAQ PDF et Cours PDF
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 18/01/2007, 09h11   #1
Membre habitué
 
Inscription : mai 2002
Messages : 475
Détails du profil
Informations forums :
Inscription : mai 2002
Messages : 475
Points : 105
Points : 105
Par défaut Récupérer texte pdf avec php

Bonjour

est il possible de recuperer le texte se trouvant dans un .pdf en ligne?

Merci
nicerico est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/01/2007, 09h31   #2
Membre éclairé
 
Avatar de Space Cowboy
 
Inscription : avril 2005
Messages : 495
Détails du profil
Informations forums :
Inscription : avril 2005
Messages : 495
Points : 306
Points : 306
J'ai déjà exporter des données php => PDF, l'inversr doit forcement exister, bien que je n'ai jamais vu d'exemple.

http://fpdi.setasign.de/index.php?p=demo
Ici, il extrait des données d'un pdf, et les réaffiche dans un autre pdf.

Sinon, http://www.google.fr/search?hl=fr&q=...e+Google&meta=
Space Cowboy est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/01/2007, 09h35   #3
Membre habitué
 
Inscription : mai 2002
Messages : 475
Détails du profil
Informations forums :
Inscription : mai 2002
Messages : 475
Points : 105
Points : 105
merci pour les liens

Citation:
http://fpdi.setasign.de/index.php?p=demo
Ici, il extrait des données d'un pdf, et les réaffiche dans un autre pdf.
oui je l'avais deja vu mais je ne vois pas comment l'adapter pour ne recuperer que le texte ???

j'ai recuperer aussi ça mais sans reussir à le faire fonctionner :
Code :
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
38
39
40
41
42
43
44
45
 
echo $test =      pdf2string("AC3.pdf");
function pdf2string ($sourceFile)
  {
   $textArray = array ();
   $objStart = 0;
 
   $fp = fopen ($sourceFile, 'rb');
   $content = fread ($fp, filesize ($sourceFile));
   fclose ($fp);
 
   $searchTagStart = chr(13).chr(10).'stream';
   $searchTagStartLenght = strlen ($searchTagStart);
 
   while ((($objStart = strpos ($content, $searchTagStart, $objStart)) && ($objEnd = strpos ($content, 'endstream', $objStart+1))))
   {
     $data = substr ($content, $objStart + $searchTagStartLenght + 2, $objEnd - ($objStart + $searchTagStartLenght) - 2);
     $data = @gzuncompress ($data);
 
     if ($data !== FALSE && strpos ($data, 'BT') !== FALSE && strpos ($data, 'ET') !== FALSE)
     {
       echo $textArray [] = ExtractText ($data);
     }
 
     $objStart = $objStart < $objEnd ? $objEnd : $objStart + 1;
   }
 
   return $textArray;
  }
 
  function ExtractText ($postScriptData)
  {
   while ((($textStart = strpos ($postScriptData, '(', $textStart)) && ($textEnd = strpos ($postScriptData, ')', $textStart + 1)) && substr ($postScriptData, $textEnd - 1) != '\\'))
   {
     $plainText .= substr ($postScriptData, $textStart + 1, $textEnd - $textStart - 1);
     if (substr ($postScriptData, $textEnd + 1, 1) == ']') //this adds quite some additional spaces between the words
     {
       $plainText .= ' ';
     }
 
     $textStart = $textStart < $textEnd ? $textEnd : $textStart + 1;
   }
 
   return stripslashes ($plainText);
  }
il me retourne : Array
et si je fais :
il me retourne : 0
nicerico est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 20h09.


 
 
 
 
Partenaires

Hébergement Web