IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques et frameworks PHP Discussion :

[TCPDF][FPDF] Propriétés personnalisées du document


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    821
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 821
    Points : 280
    Points
    280
    Par défaut [TCPDF][FPDF] Propriétés personnalisées du document
    Bonjour à tous

    Après avoir galerer pas mal pour trouver une biblio que me permette de créer de pages avec des dimensions différntes, j'ai finalement opté par TCPDF.

    Par contre j'ai besoin de créer des Propriétés du Document Personnalisées.
    Donc de type clé/valeur pour placer des choses du genre:

    Numéro Commande : XXXX
    Code Postal client : 75015

    etc,etc

    je ne trouve pas, ni sur FPDF ni sur TCPDF la commande qui me permette de faire cela.

    Est-ce que j'ai loupé quelque chose?

    merci beaucoup à tous ceux qui pourraient me donner plus de lumière

  2. #2
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    Bonjour,

    Voir :
    FPDF->SetKeywords()
    TCPDF->SetKeywords()
    Après il va falloir standardiser l'organisation de tes mots clés pour t'y retrouver.

  3. #3
    Membre actif
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    821
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 821
    Points : 280
    Points
    280
    Par défaut
    bonjour et merci de ta réponse

    SetKeyWords permet d'insérer des méta-données? je croyais que c'était tout simplement des mots clés de recherche ou autre.

    Dans ce cas je vais faire un test. Merci

    Puis j'ai trouvé aussi SetExtraXMP ; qu'en penses-tu, est-ce que ceci pourrait correspondre aussi à des méta-données?

    merci encore

    Je reviens sur le post car j'ai regardé les propriétés d'un PDF. sur cette image jointe il y a les mots clés tel que tu me conseilles mais il y a aussi les propriétés personnalisées (nom/valeur) et ce sont celles-là que j'ai besoin de créer.

    Tu vois? ce n'est pas des mots clés mais des méta-données.
    As-tu une autre idée, ou bien quelqu'un d'autre?
    merci encore
    Images attachées Images attachées  

  4. #4
    Membre actif
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    821
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 821
    Points : 280
    Points
    280
    Par défaut


    personne pour m'aider à insérer des propriétés personnalisées???

    pour le reste de la création du pdf j'utilise tcpdf

    j'ai vraiment besoin de vos lumières

    merci
    Images attachées Images attachées  

  5. #5
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    Bonjour,

    Pour pouvoir exploiter tes données comme si tu les avais saisies dans un soft PDF, il va falloir te pencher sur la syntaxe des metadata du PDF (XMP : Extensible Metadata Platform).
    Quand tu appelles SetExtraXMP les données passées vont se ranger en bas de ce bout de code de génération du PDF : $this->custom_xmp;(Lignes 12295 à 12352 dans le fichier tcpdf.php)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    // XMP extension schemas
    $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#">'."\n";
    $xmp .= "\t\t\t".'<pdfaExtension:schemas>'."\n";
    $xmp .= "\t\t\t\t".'<rdf:Bag>'."\n";
    $xmp .= "\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://ns.adobe.com/pdf/1.3/</pdfaSchema:namespaceURI>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:prefix>pdf</pdfaSchema:prefix>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>'."\n";
    $xmp .= "\t\t\t\t\t".'</rdf:li>'."\n";
    $xmp .= "\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://ns.adobe.com/xap/1.0/mm/</pdfaSchema:namespaceURI>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:prefix>xmpMM</pdfaSchema:prefix>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:schema>XMP Media Management Schema</pdfaSchema:schema>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:property>'."\n";
    $xmp .= "\t\t\t\t\t\t\t".'<rdf:Seq>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>UUID based identifier for specific incarnation of a document</pdfaProperty:description>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>InstanceID</pdfaProperty:name>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>URI</pdfaProperty:valueType>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
    $xmp .= "\t\t\t\t\t\t\t".'</rdf:Seq>'."\n";
    $xmp .= "\t\t\t\t\t\t".'</pdfaSchema:property>'."\n";
    $xmp .= "\t\t\t\t\t".'</rdf:li>'."\n";
    $xmp .= "\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://www.aiim.org/pdfa/ns/id/</pdfaSchema:namespaceURI>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:prefix>pdfaid</pdfaSchema:prefix>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:schema>PDF/A ID Schema</pdfaSchema:schema>'."\n";
    $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:property>'."\n";
    $xmp .= "\t\t\t\t\t\t\t".'<rdf:Seq>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>Part of PDF/A standard</pdfaProperty:description>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>part</pdfaProperty:name>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>Integer</pdfaProperty:valueType>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>Amendment of PDF/A standard</pdfaProperty:description>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>amd</pdfaProperty:name>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>Conformance level of PDF/A standard</pdfaProperty:description>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>conformance</pdfaProperty:name>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'."\n";
    $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
    $xmp .= "\t\t\t\t\t\t\t".'</rdf:Seq>'."\n";
    $xmp .= "\t\t\t\t\t\t".'</pdfaSchema:property>'."\n";
    $xmp .= "\t\t\t\t\t".'</rdf:li>'."\n";
    $xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
    $xmp .= "\t\t\t".'</pdfaExtension:schemas>'."\n";
    $xmp .= "\t\t".'</rdf:Description>'."\n";
    $xmp .= "\t".'</rdf:RDF>'."\n";
    $xmp .= $this->custom_xmp;
    $xmp .= '</x:xmpmeta>'."\n";
    $xmp .= '<?xpacket end="w"?>';
    Si tu le parcours, tu y trouveras des mot-clés bien connus avec leur syntaxe, à toi de copier.

  6. #6
    Membre actif
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    821
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 821
    Points : 280
    Points
    280
    Par défaut
    Salut et merci de ta réponse
    j'ai déjà tenté ce que tu me proposes... sans succès

    Déjà je ne suis pas trop d'accord avec l'emplacement du code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $xmp .= $this->custom_xmp;
    Pour moi il faut qu'il soit avant la fermeture
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $xmp .= "\t".'</rdf:RDF>'."\n";
    ou pas

    mais bon pas grave, je le garde tel que c'est par défaut bien sûr

    Si j'ai bien lu (compris ) la doc sur XMP, ceci devrait correspondre au namespace pdfx.
    C'est bien ça ou suis-je à côté?

    si c'est les pdfx, et lorsque je fais cela je ne vois pas du tout les propriétés personnalisées

    Par contre le pdf de mon client, c'est à dire le pdf que j'ai donné en image jointe sur mon post précédent et qui comporte bien les propriétés personnalisées, n'a pas du tout les pdfx.
    voir nouvelle image jointe sur laquelle je ne vois pas le pdfx sur un pdf qui comporte bien les propriétées personnalisées

    Donc je dois rater quelque chose.
    Quel est donc le namespace pour ces propriétés???

    merci beaucoup, j'ai vraiment besoin de ton aide, je suis totalement perdue

    Images attachées Images attachées  

  7. #7
    Expert éminent sénior
    Avatar de rawsrc
    Homme Profil pro
    Dev indep
    Inscrit en
    Mars 2004
    Messages
    6 142
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 47
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev indep

    Informations forums :
    Inscription : Mars 2004
    Messages : 6 142
    Points : 16 545
    Points
    16 545
    Billets dans le blog
    12
    Par défaut
    Bonjour,

    J'ai parcouru un peu la norme XMP d'Adobe et il est possible en modifiant un peu TCPDF de rajouter des mot-clés+valeur.

    Voici les modifs que j'y ai apporté :
    En ligne 12218 j'ai ajouté ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
       private $metadata = array();
     
       /**
        * $key doit être obligatoirement unique et différent des autres propriétés définissables par défaut
        * @param string $key
        * @param string $value
        */
       public function addMetaData($key, $value) {
          $this->metadata[$key] = $value;
       }
    Ensuite j'ai modifié la fonction _putXMP() pour tenir compte des metadata :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    protected function _putXMP() {
       $oid = $this->_newobj();
       // store current isunicode value
       $prev_isunicode = $this->isunicode;
       $this->isunicode = true;
       $prev_encrypted = $this->encrypted;
       $this->encrypted = false;
       // set XMP data
       $xmp = '<?xpacket begin="'.$this->unichr(0xfeff).'" id="W5M0MpCehiHzreSzNTczkc9d"?>'."\n";
       $xmp .= '<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04">'."\n";
       $xmp .= "\t".'<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'."\n";
       $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n";
       $xmp .= "\t\t\t".'<dc:format>application/pdf</dc:format>'."\n";
       $xmp .= "\t\t\t".'<dc:title>'."\n";
       $xmp .= "\t\t\t\t".'<rdf:Alt>'."\n";
       $xmp .= "\t\t\t\t\t".'<rdf:li xml:lang="x-default">'.$this->_escapeXML($this->title).'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t".'</rdf:Alt>'."\n";
       $xmp .= "\t\t\t".'</dc:title>'."\n";
       $xmp .= "\t\t\t".'<dc:creator>'."\n";
       $xmp .= "\t\t\t\t".'<rdf:Seq>'."\n";
       $xmp .= "\t\t\t\t\t".'<rdf:li>'.$this->_escapeXML($this->author).'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t".'</rdf:Seq>'."\n";
       $xmp .= "\t\t\t".'</dc:creator>'."\n";
       $xmp .= "\t\t\t".'<dc:description>'."\n";
       $xmp .= "\t\t\t\t".'<rdf:Alt>'."\n";
       $xmp .= "\t\t\t\t\t".'<rdf:li xml:lang="x-default">'.$this->_escapeXML($this->subject).'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t".'</rdf:Alt>'."\n";
       $xmp .= "\t\t\t".'</dc:description>'."\n";
       $xmp .= "\t\t\t".'<dc:subject>'."\n";
       $xmp .= "\t\t\t\t".'<rdf:Bag>'."\n";
       $xmp .= "\t\t\t\t\t".'<rdf:li>'.$this->_escapeXML($this->keywords).'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
       $xmp .= "\t\t\t".'</dc:subject>'."\n";
       $xmp .= "\t\t".'</rdf:Description>'."\n";
       // convert date format
       $docdate = substr($this->doc_date, 0, 4).'-'.substr($this->doc_date, 4, 2).'-'.substr($this->doc_date, 6, 2);
       $docdate .= 'T'.substr($this->doc_date, 8, 2).':'.substr($this->doc_date, 10, 2).':'.substr($this->doc_date, 12, 2);
       $docdate .= '+'.substr($this->doc_date, 15, 2).':'.substr($this->doc_date, 18, 2);
       $docdate = $this->_escapeXML($docdate);
       $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">'."\n";
       $xmp .= "\t\t\t".'<xmp:CreateDate>'.$docdate.'</xmp:CreateDate>'."\n";
       $xmp .= "\t\t\t".'<xmp:CreatorTool>TCPDF</xmp:CreatorTool>'."\n";
       $xmp .= "\t\t\t".'<xmp:ModifyDate>'.$docdate.'</xmp:ModifyDate>'."\n";
       $xmp .= "\t\t\t".'<xmp:MetadataDate>'.$docdate.'</xmp:MetadataDate>'."\n";
       $xmp .= "\t\t".'</rdf:Description>'."\n";
       $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'."\n";
       $xmp .= "\t\t\t".'<pdf:Keywords>'.$this->_escapeXML($this->keywords).' TCPDF</pdf:Keywords>'."\n";
       $xmp .= "\t\t\t".'<pdf:Producer>'.$this->_escapeXML("\x54\x43\x50\x44\x46\x20".$this->tcpdf_version."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29").'</pdf:Producer>'."\n";
       $xmp .= "\t\t".'</rdf:Description>'."\n";
     
       if ( ! empty($this->metadata)) {
          foreach($this->metadata as $k => $v) {
             $data[] = "\t\t\t<pdf:$k>".$this->_escapeXML($v)."<pdf:$k>"; 
          }
          $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'."\n";
          $xmp .= implode("\n", $data);
          $xmp .= "\t\t".'</rdf:Description>'."\n";
       }
     
       $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">'."\n";
       $uuid = 'uuid:'.substr($this->file_id, 0, 8).'-'.substr($this->file_id, 8, 4).'-'.substr($this->file_id, 12, 4).'-'.substr($this->file_id, 16, 4).'-'.substr($this->file_id, 20, 12);
       $xmp .= "\t\t\t".'<xmpMM:DocumentID>'.$uuid.'</xmpMM:DocumentID>'."\n";
       $xmp .= "\t\t\t".'<xmpMM:InstanceID>'.$uuid.'</xmpMM:InstanceID>'."\n";
       $xmp .= "\t\t".'</rdf:Description>'."\n";
       if ($this->pdfa_mode) {
          $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">'."\n";
          $xmp .= "\t\t\t".'<pdfaid:part>1</pdfaid:part>'."\n";
          $xmp .= "\t\t\t".'<pdfaid:conformance>B</pdfaid:conformance>'."\n";
          $xmp .= "\t\t".'</rdf:Description>'."\n";
       }
       // XMP extension schemas
       $xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#">'."\n";
       $xmp .= "\t\t\t".'<pdfaExtension:schemas>'."\n";
       $xmp .= "\t\t\t\t".'<rdf:Bag>'."\n";
       $xmp .= "\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://ns.adobe.com/pdf/1.3/</pdfaSchema:namespaceURI>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:prefix>pdf</pdfaSchema:prefix>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>'."\n";
       $xmp .= "\t\t\t\t\t".'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://ns.adobe.com/xap/1.0/mm/</pdfaSchema:namespaceURI>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:prefix>xmpMM</pdfaSchema:prefix>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:schema>XMP Media Management Schema</pdfaSchema:schema>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:property>'."\n";
       $xmp .= "\t\t\t\t\t\t\t".'<rdf:Seq>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>UUID based identifier for specific incarnation of a document</pdfaProperty:description>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>InstanceID</pdfaProperty:name>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>URI</pdfaProperty:valueType>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t\t\t\t".'</rdf:Seq>'."\n";
       $xmp .= "\t\t\t\t\t\t".'</pdfaSchema:property>'."\n";
       $xmp .= "\t\t\t\t\t".'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://www.aiim.org/pdfa/ns/id/</pdfaSchema:namespaceURI>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:prefix>pdfaid</pdfaSchema:prefix>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:schema>PDF/A ID Schema</pdfaSchema:schema>'."\n";
       $xmp .= "\t\t\t\t\t\t".'<pdfaSchema:property>'."\n";
       $xmp .= "\t\t\t\t\t\t\t".'<rdf:Seq>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>Part of PDF/A standard</pdfaProperty:description>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>part</pdfaProperty:name>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>Integer</pdfaProperty:valueType>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>Amendment of PDF/A standard</pdfaProperty:description>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>amd</pdfaProperty:name>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>Conformance level of PDF/A standard</pdfaProperty:description>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>conformance</pdfaProperty:name>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'."\n";
       $xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t\t\t\t".'</rdf:Seq>'."\n";
       $xmp .= "\t\t\t\t\t\t".'</pdfaSchema:property>'."\n";
       $xmp .= "\t\t\t\t\t".'</rdf:li>'."\n";
       $xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
       $xmp .= "\t\t\t".'</pdfaExtension:schemas>'."\n";
       $xmp .= "\t\t".'</rdf:Description>'."\n";
       $xmp .= "\t".'</rdf:RDF>'."\n";
       $xmp .= $this->custom_xmp;
       $xmp .= '</x:xmpmeta>'."\n";
       $xmp .= '<?xpacket end="w"?>';
       $out = '<< /Type /Metadata /Subtype /XML /Length '.strlen($xmp).' >> stream'."\n".$xmp."\n".'endstream'."\n".'endobj';
       // restore previous isunicode value
       $this->isunicode = $prev_isunicode;
       $this->encrypted = $prev_encrypted;
       $this->_out($out);
       return $oid;
    }
    ça devrait le faire.

  8. #8
    Membre actif
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    821
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 821
    Points : 280
    Points
    280
    Par défaut
    Merci beaucoup de ton aide précieuse!!!

    je vais regarder tout ceci de près!!!

    merci encore

    Par contre la seule chose qui me tracasse (mais des tests vont suivre) c'est pourquoi sur PDF-XChange Viewer qui me montre toute l'arborescence XMP, ne me montre pas pas ces propriétés sous le namespace pdf

    Affaire à suivre mais ton aide me redonne une possibilité et je t'en remercie encore

  9. #9
    Membre actif
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    821
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 821
    Points : 280
    Points
    280
    Par défaut
    Salut rawsrc

    en fait comme je t'avais dit, cette solution ne donne pas le résultat cherché.

    Je le craignais suite à l'analyse des données à l'aide d'Adobe Reader et de PDF-XChange Viewer.

    Aucune valeur des propriétés personnalisées n'est visible sous le namespace pdf

    Par contre!!!!! j'ai trouvé!!!

    Pour test j'ai mis en dur ceci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    46
    	protected function _putinfo() {
    		$oid = $this->_newobj();
    		$out = '<<';
    		// store current isunicode value
    		$prev_isunicode = $this->isunicode;
    		if ($this->docinfounicode) {
    			$this->isunicode = true;
    		}
    		if (!$this->empty_string($this->title)) {
    			// The document's title.
    			$out .= ' /Title '.$this->_textstring($this->title, $oid);
    		}
    		if (!$this->empty_string($this->author)) {
    			// The name of the person who created the document.
    			$out .= ' /Author '.$this->_textstring($this->author, $oid);
    		}
    		if (!$this->empty_string($this->subject)) {
    			// The subject of the document.
    			$out .= ' /Subject '.$this->_textstring($this->subject, $oid);
    		}
    		if (!$this->empty_string($this->keywords)) {
    			// Keywords associated with the document.
    			$out .= ' /Keywords '.$this->_textstring($this->keywords.' TCPDF', $oid);
    		}
    		if (!$this->empty_string($this->creator)) {
    			// If the document was converted to PDF from another format, the name of the conforming product that created the original document from which it was converted.
    			$out .= ' /Creator '.$this->_textstring($this->creator, $oid);
    		}
    		// restore previous isunicode value
    		$this->isunicode = $prev_isunicode;
    		// default producer
    		$out .= ' /Producer '.$this->_textstring("\x54\x43\x50\x44\x46\x20".$this->tcpdf_version."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29", $oid);
    		// The date and time the document was created, in human-readable form
    		$out .= ' /CreationDate '.$this->_datestring();
    		// The date and time the document was most recently modified, in human-readable form
    		$out .= ' /ModDate '.$this->_datestring();
    		
    		$out .= ' /eDoc '.'(toto)';		
    		
    		// A name object indicating whether the document has been modified to include trapping information
    		$out .= ' /Trapped /False';
    		$out .= ' >>';
    		$out .= "\n".'endobj';
    		$this->_out($out);
    		return $oid;
    	}
    Et ceci me crée bien la propriétés personnalisées eDoc / toto

    Donc il me semble avoir trouvé la soluss. Par contre comme tu l'avais dit il faut modifier la classe de base afin de gérer ces données

    je te remercie encore de ton aide!!!!


  10. #10
    Membre actif
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    821
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 821
    Points : 280
    Points
    280
    Par défaut
    Donc voilà ce que j'ai fait :

    la déclaration:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    protected $custom_props = array();
    la modification de la fonction _putinfo

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
     
    	protected function _putinfo() {
    		$oid = $this->_newobj();
    		$out = '<<';
    		// store current isunicode value
    		$prev_isunicode = $this->isunicode;
    		if ($this->docinfounicode) {
    			$this->isunicode = true;
    		}
    		if (!$this->empty_string($this->title)) {
    			// The document's title.
    			$out .= ' /Title '.$this->_textstring($this->title, $oid);
    		}
    		if (!$this->empty_string($this->author)) {
    			// The name of the person who created the document.
    			$out .= ' /Author '.$this->_textstring($this->author, $oid);
    		}
    		if (!$this->empty_string($this->subject)) {
    			// The subject of the document.
    			$out .= ' /Subject '.$this->_textstring($this->subject, $oid);
    		}
    		if (!$this->empty_string($this->keywords)) {
    			// Keywords associated with the document.
    			$out .= ' /Keywords '.$this->_textstring($this->keywords.' TCPDF', $oid);
    		}
    		if (!$this->empty_string($this->creator)) {
    			// If the document was converted to PDF from another format, the name of the conforming product that created the original document from which it was converted.
    			$out .= ' /Creator '.$this->_textstring($this->creator, $oid);
    		}
    		// restore previous isunicode value
    		$this->isunicode = $prev_isunicode;
    		// default producer
    		$out .= ' /Producer '.$this->_textstring("\x54\x43\x50\x44\x46\x20".$this->tcpdf_version."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29", $oid);
    		// The date and time the document was created, in human-readable form
    		$out .= ' /CreationDate '.$this->_datestring();
    		// The date and time the document was most recently modified, in human-readable form
    		$out .= ' /ModDate '.$this->_datestring();
     
    		// gestion des propriétés personnalisées
    		// ---->>>>> ICI 
    		if ( ! empty($this->custom_props)) {
    			foreach($this->custom_props as $k => $v) {
    				$out .= ' /' . $k . '('.$this->_escapeXML($v) . ')';
    			}
    		}
    		// ---->>>>> JUSQUE LA
     
    		// A name object indicating whether the document has been modified to include trapping information
    		$out .= ' /Trapped /False';
    		$out .= ' >>';
    		$out .= "\n".'endobj';
    		$this->_out($out);
    		return $oid;
    	}
    Puis j'ai ajouté la fonction :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    	public function addCustomProperties($key, $value) {
    	  $this->custom_props[$key] = $value;
    	}
    et l'appel depuis mon code:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
    			$pdf = new TCPDF();
    			$pdf->AddPage();
    			$pdf->SetAuthor("monAuteur");
     
    			$pdf->addCustomProperties('eDoc.test1', 'ceci est un test');
    			$pdf->addCustomProperties('eDoc.test2', 'ceci est un autre test');
    			$pdf->Output('cheminverspdf/fichier.pdf', 'F');
    voilà, j'espère que ceci peut être utile à d'autres


Discussions similaires

  1. Inserer des propriétés personnalisées dans le document
    Par solahm dans le forum Microsoft Office
    Réponses: 0
    Dernier message: 25/01/2013, 17h40
  2. copier les propriétés personnalisées documents
    Par gronaze dans le forum Word
    Réponses: 1
    Dernier message: 07/07/2009, 21h52
  3. [FPDF] récupérer les propriétés d'un document pdf
    Par kitch18 dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 26/02/2008, 12h04
  4. [FPDF] Générer de larges documents PDF
    Par LEK dans le forum Bibliothèques et frameworks
    Réponses: 8
    Dernier message: 28/10/2005, 20h32
  5. Réponses: 2
    Dernier message: 31/05/2005, 07h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo