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

Contribuez Discussion :

Excel / Word / PDF avec Adobe Acrobat Pro et PDFCreator 1.7.3 (obsolète)


Sujet :

Contribuez

  1. #201
    Candidat au Club
    Femme Profil pro
    Chef de projet en SSII
    Inscrit en
    Mars 2016
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Mars 2016
    Messages : 4
    Points : 4
    Points
    4
    Par défaut Traitement par lot Acrobat Pro
    Bonjour Kiki29,

    Je suis novice sur le forum, j'espère que je pose ma question au bon endroit.

    J'ai plusieurs fichiers PDF tous construit de la même façon : un titre, plusieurs infos texte puis des tableaux.

    Je souhaiterais à partir de ces fichiers extraire des informations (le titre et une ligne de texte présente dans les infos qui correspond au nombre de commentaire sur chaque fichier).
    Ces informations, je voudrais les faire remonter dans un fichier excel qui formerait le tableau suivant:
    Nom du fichier | Texte
    Nom1 | texte1
    Nom2 | texte2
    .... | ....

    J'utilise Acrobat Pro X. J'ai essayé avec le traitement par lot. Fichier > Assistant action. Mais je n'arrive à rien...
    Peut-être est-ce plus simple d'utiliser une macro?
    J'ai vu beaucoup de bouts de code dans tes précédentes réponses mais ne sais pas vraiment comment m'en servir.

    J'espère que tu pourras m'aider

    Merci.
      0  0

  2. #202
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Salut, tu as plusieurs exemples : Pdf2Excel et Pdf2Excel 2007+ . Il te faudra rajouter les procédures pour reformater uniquement les infos désirées et auparavant peut-être qqs pbs de tempo via la constante Tempo ( indispensable avec les sendkeys ).

    Voir cette remarque pour le paramétrage du Reader : Problèmes lors de l'usage des SendKeys si Acrobat Reader 10 et +

    Ces 2 fichiers m'ont permis de traiter 6700 fichiers pdf ( 1.7 Go au total, dans 3 présentations différentes ) d'une base Kompass pour en extraire autour de 638000 entreprises avec uniquement les infos utiles.

    Après s'il s'agit de formulaires, mais j'en doute, donc c'est pour info il y a : Acrobat Pro Lecture de Formulaires PDF

    Il y a : Liste des contributions et téléchargements qui permet de naviguer dans le bazar.

    Un échantillon de un à deux fichiers pdf pourrait faciliter les choses.
      0  0

  3. #203
    Candidat au Club
    Femme Profil pro
    Chef de projet en SSII
    Inscrit en
    Mars 2016
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Mars 2016
    Messages : 4
    Points : 4
    Points
    4
    Par défaut AcrobatPro
    Merci pour cette réponse rapide.

    Pour exemple, je te joins deux fichiers.

    Ce sont des exemples basiques.
    Le fichier N12211221 affiche les informations en première page. Sur mon fichier excel j'aimerais donc afficher : N12211221 dans la colonne "Nom du fichier" et 3 commentaires dans la colonne "Texte".

    En vrai, je ne suis pas censé avoir ces infos en première page. Mais, comme dans le fichier N12211222, avoir uniquement mon tableau avec les commentaires.
    Il faut donc à partir de ce fichier, compter le nombre de commentaire et mettre dans mon fichier excel : dans la colonne "Nom du fichier", N12211222 (nom du pdf) et dans la colonne "Texte", le compte du nombre de commentaire présent sur mon fichier, ici 3.

    Sachant que cela doit être automatisé sur un grand nombre de fichiers.

    Dans ta réponse précédente, tu n'utilises pas le batch d'AcrobatPro?

    J'espère que mes explications ne sont pas trop flou.

    Merci
    Images attachées Images attachées
      0  0

  4. #204
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Salut, j'ai trouvé cela ( minimaliste ) ..... mais il me retourne le double du nombre d'annotations ( sans raison apparente ), par exemple 6 pour 3 ?

    P.-S.: Je viens de lire que les annotations ouvertes provoquaient une duplication des informations. Est-ce une explication ? auquel cas en ajoutant \ 2 ?

    Tu crées un bouton et l'affectes à la procédure SelectFichier

    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
    Option Explicit
     
    Private Sub LectureFichier_01(sFichier As String)
    Dim PDDoc As Object
    Dim PDPage As Object
    Dim iNumPage As Long
    Dim i As Long
    Dim cpt As Long
     
        Set PDDoc = CreateObject("AcroExch.PDDoc")
     
        PDDoc.Open sFichier
        iNumPage = PDDoc.GetNumPages
        cpt = 0
        If iNumPage > 0 Then
            For i = 0 To iNumPage - 1
                Set PDPage = PDDoc.AcquirePage(i)
                cpt = cpt + PDPage.GetNumAnnots() '\ 2 ?
            Next i
            MsgBox cpt
        End If
     
        PDDoc.Close
    End Sub
     
    Sub SelectFichier()
    Dim Fichier As Variant
        ChDrive ThisWorkbook.Path
        ChDir ThisWorkbook.Path
     
        Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
        If Fichier <> False Then LectureFichier_01 (Fichier)
    End Sub
    Après tu prends par exemple ce fichier et tu l'adaptes à ton contexte en reportant dans la colonne C6..Cxyz les infos fournies par la procédure LectureFichier_01.
      0  0

  5. #205
    Candidat au Club
    Femme Profil pro
    Chef de projet en SSII
    Inscrit en
    Mars 2016
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Mars 2016
    Messages : 4
    Points : 4
    Points
    4
    Par défaut Acrobat PRO
    Minimaliste? Je trouve déjà ça super!!!

    J'ai bien affecté la procédure à mon bouton mais lorsque je clic ça m'affiche le message suivant :"Argument ou appel de procédure incorrect".
    A moins que je devais changer des paramètres dans le code que tu m'as fourni... Je ne sais pas.

    Merci encore, tu m'es d'une grande aide.
      0  0

  6. #206
    Membre confirmé Avatar de graphikris
    Homme Profil pro
    Pas tres doué
    Inscrit en
    Décembre 2012
    Messages
    1 215
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Pas tres doué
    Secteur : Conseil

    Informations forums :
    Inscription : Décembre 2012
    Messages : 1 215
    Points : 523
    Points
    523
    Par défaut
    Bonjour Kiki29,
    Je suis confrontée à un souci mineur.
    J'extrais d'un fichier Excel des données pour les publier au format Pdf directement sur un site interne de mon entreprise.
    Pour le publier, je l'envoie vers un serveur interne qui tourne a son maximum. Mon souci est que dès que je lance ma macro, parfois le serveur est occupé et dans ce cas je tombe sur le msg d'erreur d'Excel qui me dit : "Fin" ou "Débogage".
    Comment faire pour éviter ce msg et avoir à la place : "Serveur occupé, veuillez relancer votre macro ultérieurement."

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    'Publication du fichier en Pdf
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
                                        Filename:="H:\perso\Extraction referentiel documentaire.pdf", _
                                        Quality:=xlQualityStandard, _
                                        IncludeDocProperties:=True, _
                                        IgnorePrintAreas:=False, _
                                        OpenAfterPublish:=False
     
     
        ActiveWorkbook.Close False
     
      rep = MsgBox("Votre extraction a été effectuée avec succès. Vous pouvez la consulter directement sur le portail interne dans la rubrique Documents.", vbYes + vbInformation, "Publication de document...")
     
    End Sub
    Cordialement.
      0  1

  7. #207
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut Acrobat : Compter les Commentaires
    Acrobat : Une version qui semble elle correcte, à tester plus à fond.

    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
    Option Explicit
     
    Private Sub LectureFichier(sFichier As String)
    Dim PDDoc As Object
    Dim PDPage As Object
    Dim iNumPage As Long
    Dim Annot As Object
    Dim i As Long, j As Long
    Dim cpt As Long, iAnnots As Long
     
        Set PDDoc = CreateObject("AcroExch.PDDoc")
     
        PDDoc.Open sFichier
        iNumPage = PDDoc.GetNumPages
        cpt = 0
        If iNumPage > 0 Then
            For i = 0 To iNumPage - 1
                Set PDPage = PDDoc.AcquirePage(i)
                iAnnots = PDPage.GetNumAnnots
                For j = 0 To iAnnots - 1
                    Set Annot = PDPage.GetAnnot(j)
                    If (Annot.GetContents <> "" And Annot.GetSubtype <> "Popup") Then
                        cpt = cpt + 1
                    End If
                Next j
            Next i
            MsgBox cpt
        End If
     
        PDDoc.Close
        Set PDDoc = Nothing
    End Sub
     
    Sub SelectFichier()
    Dim Fichier As Variant
        ChDrive ThisWorkbook.Path
        ChDir ThisWorkbook.Path
     
        Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
        If Fichier <> False Then LectureFichier (Fichier)
    End Sub
      0  0

  8. #208
    Candidat au Club
    Femme Profil pro
    Chef de projet en SSII
    Inscrit en
    Mars 2016
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Pyrénées Atlantiques (Aquitaine)

    Informations professionnelles :
    Activité : Chef de projet en SSII

    Informations forums :
    Inscription : Mars 2016
    Messages : 4
    Points : 4
    Points
    4
    Par défaut
    Bonjour Kiki,

    J'avais bien créé le bouton et affecté la procédure. C'est une fois que je clic sur mon bouton que j'ai le message d'erreur :"Argument ou appel de procédure incorrect".
      0  0

  9. #209
    Membre confirmé Avatar de graphikris
    Homme Profil pro
    Pas tres doué
    Inscrit en
    Décembre 2012
    Messages
    1 215
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Pas tres doué
    Secteur : Conseil

    Informations forums :
    Inscription : Décembre 2012
    Messages : 1 215
    Points : 523
    Points
    523
    Par défaut
    Citation Envoyé par kiki29 Voir le message
    Salut, aucune idée, n'ayant plus de serveur à disposition. Voir si en le sauvant d'abord en local sur ton pc puis ensuite en le copiant sur ton serveur cela change qqch.
    Ok, je vais poser la question dans le forum "Macros et VBA"
    Merci tout de meme
      0  0

  10. #210
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut Acrobat : Lecture des Commentaires
    Acrobat : A placer dans un module standard sous Word

    Appeler la procédure SelFichierPDF.

    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
    Option Explicit
     
    Sub SelFichierPDF()
    Dim sChemin As String
        sChemin = ThisDocument.Path
        With Application.FileDialog(msoFileDialogFilePicker)
            .InitialFileName = sChemin & "\"
            .Title = "Sélectionner le Fichier"
            .AllowMultiSelect = False
            .Filters.Clear
            .Filters.Add "PDF ", "*.pdf", 1
            .InitialView = msoFileDialogViewDetails
            .ButtonName = "Sélection Fichier"
            .Show
            If .SelectedItems.Count > 0 Then
                DoEvents
                OuvrirPDF_Page .SelectedItems(1), 1
                LireCommentaires
            End If
        End With
    End Sub
     
    Private Sub OuvrirPDF_Page(ByVal sFichier As String, iPage As Long)
    Dim PdfApp As Object
    Dim PdfDoc As Object
    Dim PdfPageView As Object
     
        Set PdfApp = CreateObject("AcroExch.App")
        Set PdfDoc = CreateObject("AcroExch.AVDoc")
     
        If PdfDoc.Open(sFichier, "") Then
            PdfDoc.BringToFront
            PdfDoc.Maximize False
     
            Set PdfPageView = PdfDoc.GetAVPageView()
            With PdfPageView
                .GoTo iPage - 1
                .ZoomTo 2, 50
            End With
     
            Set PdfPageView = Nothing
        End If
     
        Set PdfDoc = Nothing
        Set PdfApp = Nothing
    End Sub
     
    Private Sub LireCommentaires()
    Dim AcroApp As Object
    Dim i As Long, j As Long
    Dim NewDoc As Document
    Dim NewDocRange As Range
    Dim bNotes As Boolean
    Dim AVDoc As Object, PDDoc As Object
    Dim iPages As Long
    Dim PDPage As Object
    Dim bEntete As Boolean
    Dim iAnnots As Long
    Dim annot As Object
     
        Set AcroApp = CreateObject("AcroExch.App")
     
        If (0 < AcroApp.GetNumAVDocs) Then
            Set NewDoc = Documents.Add(DocumentType:=wdNewBlankDocument)
            Set NewDocRange = NewDoc.Range
     
            bNotes = False
     
            Set AVDoc = AcroApp.GetActiveDoc
            Set PDDoc = AVDoc.GetPDDoc
     
            iPages = PDDoc.GetNumPages
            For i = 0 To iPages - 1
                Set PDPage = PDDoc.AcquirePage(i)
                If (Not PDPage Is Nothing) Then
                    bEntete = False
                    iAnnots = PDPage.GetNumAnnots
                    For j = 0 To iAnnots - 1
                        Set annot = PDPage.GetAnnot(j)
                        If (annot.GetContents <> "" And annot.GetSubtype <> "Popup") Then
                            If (bEntete = False) Then
                                With NewDocRange
                                    .Collapse wdCollapseEnd
                                    .Text = "Page: " & (i + 1) & vbCr
                                    .Bold = True
                                    .ParagraphFormat.LineUnitBefore = 1
                                End With
                                bEntete = True
                            End If
                            With NewDocRange
                                .Collapse wdCollapseEnd
                                .Text = annot.GetTitle & vbCr
                                .Italic = True
                                .Font.Size = NewDocRange.Font.Size - 1
                                .ParagraphFormat.LineUnitBefore = 0.6
     
                                .Collapse wdCollapseEnd
                                .Text = annot.GetContents & vbCr
                                .Font.Size = NewDocRange.Font.Size - 2
                            End With
                            bNotes = True
                        End If
                    Next j
                End If
            Next i
     
            If (Not bNotes) Then
                With NewDocRange
                    .Collapse wdCollapseEnd
                    .Text = "Pas de notes PDF" & vbCr
                    .Bold = True
                End With
            End If
     
            AVDoc.Close True
            AcroApp.Exit
        End If
    End Sub
    Téléchargeable ici
    Images attachées Images attachées  
      1  0

  11. #211
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut Acrobat : Dénombrement commentaires PDFs
    @belxa : est-ce que cela t'aidera ?
      0  0

  12. #212
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Suite à un post de kimai ( resté sans réponse de sa part ) : Impression/Fusion de certains onglets d'un classeur en PDF

    Cette exemple permet :
    l'impression des onglets sélectionnés en PDF.
    la fusion éventuelle de ces onglets sélectionnés en PDF.
    De tenir compte des éventuels doublons.

    Le tout sauvé dans un dossier qui se crée automatiquement au même niveau que l'appli.

    Cet exemple est à adapter au contexte de l'utilisateur pour le classeur concerné.

    Pour l'adapter à un classeur spécifique :
    Décompresser le fichier via 7Zip
    Sur la feuille Recap : tout sélectionner puis le coller dans une nouvelle feuille créée pour l'adaptation dans le classeur concerné.
    Copier/coller le code dans un module standard.
    Mettre à jour le CodeName de la feuille ajoutée en shRecap
    Affecter le bouton Récap à la procédure Recap
    Affecter le bouton PDFs à la procédure EnregistrementPDF
    Lancer manuellement la procédure PosBoutons pour positionner les boutons/checkboxes

    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
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    Option Explicit
     
    Private Declare Function SHCreateDirectoryEx Lib "Shell32.dll" Alias "SHCreateDirectoryExA" _
                                                 (ByVal hwnd As Long, ByVal pszPath As String, ByVal lngsec As Long) As Long
     
    Dim Ar() As String
     
    Private Function CreationDossier(sDossier) As Long
    Dim Rep As Long
        Rep = SHCreateDirectoryEx(0&, sDossier, 0&)
    End Function
     
    Private Function DecompteA() As Boolean
    Dim LastRow As Long, i As Long
        DecompteA = False
        With shRecap
            LastRow = .Range("A" & Rows.Count).End(xlUp).Row
            For i = 1 To LastRow
                If UCase$(.Cells(i, 2)) = "X" Then
                    DecompteA = True
                    Exit Function
                End If
            Next i
        End With
    End Function
     
    Sub EnregistrementPDF()
    Dim sNomFichierPDF As String
    Dim i As Long, cpt As Long, LastRow As Long
    Dim FSO As Object, sNomfichier As String, sFichierPDF As String
    Dim sRacine As String, sDossierPDFs As String, sNomFichierFusion As String
        sRacine = ThisWorkbook.Path
        sDossierPDFs = "Dossier PDFs"
     
        If DecompteA = False Then
            MsgBox "Taper dans la colonne B un x ou X en vis à vis" & vbCrLf & _
                   "des Feuilles à exporter en PDF" & vbCrLf & _
                   "Ou ..... lancer la Récap", vbInformation + vbOKOnly, "x ou X"
            Exit Sub
        End If
     
        With Application
            .ScreenUpdating = False
            .StatusBar = ""
        End With
     
        If shRecap.CheckBoxes("chkPDF").Value = 1 Then
            Set FSO = CreateObject("Scripting.FileSystemObject")
            If FSO.FolderExists(sRacine & "\" & sDossierPDFs) Then _
               FSO.DeleteFolder sRacine & "\" & sDossierPDFs, True
            Set FSO = Nothing
            shRecap.CheckBoxes("chkDoublons").Value = 0
        End If
     
        CreationDossier sRacine & "\" & sDossierPDFs
     
        LastRow = shRecap.Range("A" & Rows.Count).End(xlUp).Row
        For i = 1 To LastRow
            If UCase$(shRecap.Cells(i, 2)) = "X" Then
                cpt = cpt + 1
                sNomFichierPDF = sRacine & "\" & sDossierPDFs & "\" & shRecap.Cells(i, 1)
     
                If shRecap.CheckBoxes("chkFusion").Value = 1 Then
                    If shRecap.CheckBoxes("chkDoublons").Value = 1 Then
                        sNomFichierFusion = "Fusion.pdf"
                        sNomfichier = RenommerFichier(sRacine & "\" & sDossierPDFs, sNomFichierFusion)
                    Else
                        sNomFichierFusion = sRacine & "\" & sDossierPDFs & "\" & "Fusion.pdf"
                        sNomfichier = sNomFichierFusion
                    End If
     
                    Application.ScreenUpdating = False
                    Fusion
                    Sheets(Ar).Select
                    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
                                                    Filename:=sNomfichier, _
                                                    Quality:=xlQualityStandard, _
                                                    IncludeDocProperties:=True, _
                                                    IgnorePrintAreas:=False, _
                                                    OpenAfterPublish:=False
                    Application.ScreenUpdating = True
                    shRecap.Select
                    Exit For
                Else
                    If shRecap.CheckBoxes("chkDoublons").Value = 1 Then
                        sFichierPDF = shRecap.Cells(i, 1) & ".pdf"
                        sNomfichier = RenommerFichier(sRacine & "\" & sDossierPDFs, sFichierPDF)
                    Else
                        sNomfichier = sNomFichierPDF
                    End If
                    Sheets(i).ExportAsFixedFormat Type:=xlTypePDF, _
                                                  Filename:=sNomfichier, _
                                                  Quality:=xlQualityStandard, _
                                                  IncludeDocProperties:=True, _
                                                  IgnorePrintAreas:=False, _
                                                  OpenAfterPublish:=False
                End If
                Application.StatusBar = cpt
            End If
        Next i
     
        With shRecap
            .Activate
            .Range("C1").Select
        End With
        Application.ScreenUpdating = True
    End Sub
     
    Private Sub Fusion()
    Dim i As Long, j As Long, LastRow As Long
        LastRow = shRecap.Range("A" & Rows.Count).End(xlUp).Row
        Erase Ar(): j = 0
        For i = 1 To LastRow
            If UCase$(shRecap.Cells(i, 2)) = "X" Then
                ReDim Preserve Ar(j)
                Ar(j) = Sheets(i).Name
                j = j + 1
            End If
        Next i
    End Sub
     
    Private Sub PosBoutons()
    Dim T As Range
        With shRecap
            .Activate
            Set T = .Cells(2, 4)
            With .Buttons("BtnRecap")
                .Left = T.Left + 5
                .Top = T.Top
                .Width = 50
            End With
     
            With .Buttons("BtnPdf")
                .Left = shRecap.Buttons("BtnRecap").Left
                .Top = shRecap.Buttons("BtnRecap").Top + shRecap.Buttons("BtnRecap").Height + 3
                .Height = shRecap.Buttons("BtnRecap").Height
                .Width = shRecap.Buttons("BtnRecap").Width
            End With
     
            Set T = .Cells(2, 5)
            With .Shapes("chkPDF")
                .Left = T.Left
                .Top = T.Top
                .Width = 145
                .Height = shRecap.Buttons("btnPDF").Height / 2 - 10
            End With
     
            With .Shapes("chkDoublons")
                .Left = shRecap.Shapes("chkPdf").Left
                .Top = shRecap.Shapes("chkPdf").Top + shRecap.Shapes("chkPdf").Height + 2
                .Width = shRecap.Shapes("chkPdf").Width
                .Height = shRecap.Buttons("btnPDF").Height / 2 - 10
            End With
     
            With .Shapes("chkFusion")
                .Left = shRecap.Shapes("chkPdf").Left
                .Top = shRecap.Shapes("chkDoublons").Top + shRecap.Shapes("chkDoublons").Height + 2
                .Width = shRecap.Shapes("chkPdf").Width
                .Height = shRecap.Buttons("btnPDF").Height / 2 - 10
            End With
        End With
     
        Set T = Nothing
    End Sub
     
    Sub Recap()
    Dim i As Long
        Application.ScreenUpdating = False
        shRecap.Columns("A:B").ClearContents
        For i = 1 To ThisWorkbook.Sheets.Count
            shRecap.Cells(i, 1) = Sheets(i).Name
        Next i
        shRecap.Columns("A:B").Columns.AutoFit
        Application.ScreenUpdating = True
    End Sub
     
    Private Function RenommerFichier(sDossier As String, sNomfichier As String) As String
    Dim sNouveauNom As String
    Dim sPre As String
    Dim sExt As String
    Dim iExt As Long
    Dim i As Long, Pos As Long
    Dim FSO As Object
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.FileExists(sDossier & "\" & sNomfichier) Then
            sNouveauNom = sNomfichier
            Pos = InStrRev(sNomfichier, ".")
            If Pos > 0 Then
                iExt = Len(sNomfichier) - Pos + 1
                sExt = Right$(sNomfichier, iExt)
                sPre = Left$(sNomfichier, Len(sNomfichier) - iExt)
            Else
                sExt = ""
                sPre = sNomfichier
            End If
     
            i = 0
            While FSO.FileExists(sDossier & "\" & sNouveauNom)
                i = i + 1
                sNouveauNom = sPre & Chr(40) & Format(i, "000") & Chr(41) & sExt
            Wend
            sNomfichier = sNouveauNom
        End If
        Set FSO = Nothing
     
        RenommerFichier = sDossier & "\" & sNomfichier
    End Function
    Images attachées Images attachées  
      1  0

  13. #213
    Candidat au Club
    Femme Profil pro
    Cartographe
    Inscrit en
    Avril 2016
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 28
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Cartographe
    Secteur : Distribution

    Informations forums :
    Inscription : Avril 2016
    Messages : 2
    Points : 3
    Points
    3
    Par défaut Assembler des PDF deux à deux en lot
    Bonjour

    je suis cartographe et nous produisons des plans format pdf et Jpeg que nous souhaiterions assembler en un seul PDF. Complètement novice en programmation, je sais pourtant que la solution se trouve ici.

    Notre architecture est la suivante

    Dossier 1
    carte_012.pdf

    Dossier 2
    Carte_012.jpeg

    Le jpg doit se trouver en page 1 du pdf.

    Pourriez vous m'aider ??


    Merci beaucoup
      0  0

  14. #214
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Salut, pour des cas simples il y a dans ce blog des exemples de transformation de jpg en pdf ainsi que de fusion de pdf, voir Liste des contributions et téléchargements pour naviguer dans le bazar. Cela via Acrobat ( pas le Reader ) et PDFCreator 1.7.3.
    Cependant dans ton cas peut-être que l'investissement dans Acrobat serait préférable ? Il existe une version téléchargeable en essai pendant 1 mois, si mes souvenirs sont exacts.

    Il y a PDFArchitect qui en version gratuite permet déjà qqch.

    Un ou 2 échantillons de fichiers ( non confidentiels ) avec aussi une sortie du résultat souhaité, permettraient de juger de la faisabilité de la chose.

    Sinon extraits de la liste donnée plus haut :
    PDFCreator Conversion dossier Jpg/Jpeg en PDFs protégés par mots de passe propriétaire/utilisateur

    PDFCreator Conversion dossier Images en PDFs protégés par mots de passe propriétaire/utilisateur
    PDFCreator Conversion d'images Tif Bmp Png Jpg Gif d'un dossier dans un seul PDF résultant
    Acrobat : Conversion Image Tif Bmp Gif Jpg en PDF
    Acrobat : Fusion de fichiers PDF
    PDFCreator : Fusion des PDF d'un Dossier
      0  0

  15. #215
    Candidat au Club
    Femme Profil pro
    Cartographe
    Inscrit en
    Avril 2016
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 28
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Cartographe
    Secteur : Distribution

    Informations forums :
    Inscription : Avril 2016
    Messages : 2
    Points : 3
    Points
    3
    Par défaut
    Citation Envoyé par kiki29 Voir le message
    Salut, pour des cas simples il y a dans ce blog des exemples de fusion de pdf ainsi que de transformation de jpg en pdf
    voir Liste des contributions et téléchargements pour naviguer dans le bazar. Cela via Acrobat et PDFCreator.
    Cependant dans ton cas peut-être que l'investissement dans Acrobat serait préférable ? Il existe une version téléchargeable en essai pendant 1 mois, si mes souvenirs sont exacts.


    Bonjour Kiki, merci de ta réponse rapide

    alors nous avons la version pro d'Acrobat reader XI, cela peut il suffire. Après je pensais éventuellement à un Jvs pour illustrator ?
      0  0

  16. #216
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Salut, inutile de fonctionner par psittacisme. Bref comme demandé plus haut : un ou 2 échantillons de fichiers ( non confidentiels ), permettraient de juger de la faisabilité de la chose.
      0  0

  17. #217
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut Acrobat : Modifier les Commentaires d'un PDF
    Acrobat : Modifier les Commentaires d'un PDF

    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
    Option Explicit
     
    Sub ModifCommentaire()
    Dim PDDoc As Object
    Dim PDPage As Object
    Dim Annot As Object
    Dim sChemin As String, sCheminModif As String
    Dim iPage As Long, iAnnots As Long
     
        sChemin = ThisWorkbook.path & "\" & "Test.pdf"
        sCheminModif = ThisWorkbook.path & "\" & "Test_mod.pdf"
     
        Set PDDoc = CreateObject("AcroExch.PDDoc")
     
        If PDDoc.Open(sChemin) Then
            iPage = PDDoc.GetNumPages
            If iPage > 0 Then
                Set PDPage = PDDoc.AcquirePage(0)
                iAnnots = PDPage.GetNumAnnots()
                If iAnnots > 0 Then
     
                    Set Annot = PDPage.GetAnnot(0)
                    Annot.SetContents ("Test Modification Commentaire")
                    PDDoc.Save 1, sCheminModif
                    PDDoc.Close
     
                    Set Annot = Nothing
                    Set PDPage = Nothing
                    Set PDDoc = Nothing
                End If
            End If
        End If
    End Sub
    Images attachées Images attachées  
      0  0

  18. #218
    Futur Membre du Club
    Homme Profil pro
    Inscrit en
    Octobre 2012
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Octobre 2012
    Messages : 6
    Points : 9
    Points
    9
    Par défaut Identifier le format de chaque page d'un PDF
    Bonjour,

    Je souhaiterais pouvoir identifier (récupérer) via VBA le format (A4, A3, ...), ou a minima les dimensions, de chaque page d'un PDF.

    Malgré mes recherches ça et là ainsi que dans la liste des contributions de cette discussion, je n'ai pas trouvé de solution. J'espère cependant qu'il en existe une, et de surcroît avec Acrobat Reader ou PDFCreator.

    Merci d'avance pour vos éventuelles suggestions.

    Fabien
      0  0

  19. #219
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Acrobat : Dimensions des pages d'un PDF

    C'est possible via Acrobat ( pas le Reader ) les dimensions retournées x,y sont en points pour une résolution de 72 dpi.

    Affecter un bouton à la procédure SelectFichier.
    Changer le CodeName de la feuille recevant les infos en shInfo.

    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
    Option Explicit
     
    Sub SelectFichier()
    Dim Fichier As Variant
        ChDir ThisWorkbook.Path
     
        Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
        If Fichier <> False Then Taille (Fichier)
    End Sub
     
    Private Function Taille(ByVal sFichier As String) As String
    Dim AVDoc As Object, PDDoc As Object, PDPage As Object
    Dim Rect As Object
    Dim x As Long, y As Long
    Dim iPage As Long, i As Long, j As Long
     
        Set AVDoc = CreateObject("AcroExch.AVDoc")
     
        If AVDoc.Open(sFichier, "") Then
            shInfo.Columns("A:C").Clear
            Application.ScreenUpdating = False
     
            Set PDDoc = AVDoc.GetPDDoc()
            iPage = PDDoc.GetNumPages: j = 1
            If iPage > 0 Then
                For i = 0 To iPage - 1
                    Set PDPage = AVDoc.GetPDDoc.AcquirePage(i)
     
                    Set Rect = PDPage.GetSize()
                    x = Rect.x
                    y = Rect.y
                    Set Rect = Nothing
     
                    With shInfo
                        .Cells(j, 1) = j
                        .Cells(j, 2) = x * 0.035277778 
                        .Cells(j, 3) = y * 0.035277778 
                    End With
                    j = j + 1
                Next i
            End If
     
            PDDoc.Close
            AVDoc.Close True
     
            Set PDPage = Nothing
            Set PDDoc = Nothing
            Set AVDoc = Nothing
     
            With shInfo
                .Columns("B:C").NumberFormat = "0.00"
                .Columns("A:C").EntireColumn.AutoFit
                .Range("D1").Select
            End With
            Application.ScreenUpdating = True
        End If
    End Function
    Images attachées Images attachées  
      0  0

  20. #220
    Expert éminent sénior
    Avatar de kiki29
    Homme Profil pro
    ex Observeur CGG / Analyste prog.
    Inscrit en
    Juin 2006
    Messages
    6 132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Finistère (Bretagne)

    Informations professionnelles :
    Activité : ex Observeur CGG / Analyste prog.

    Informations forums :
    Inscription : Juin 2006
    Messages : 6 132
    Points : 11 274
    Points
    11 274
    Par défaut
    Acrobat : Ajout de Commentaires à un PDF

    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
    Option Explicit
     
    Sub AjoutCommentaire()
    Dim PDDoc As Object
    Dim Page As Object
    Dim JSO As Object
    Dim sChemin As String, sCheminAjout As String
    Dim Point(1) As Long
    Dim PopupRect(3) As Long
    Dim PageRect As Object
    Dim Annot As Object
    Dim Props As Object
     
        sChemin = ThisWorkbook.path & "\" & "Test.pdf"
        sCheminAjout = ThisWorkbook.path & "\" & "Test_Ajout.pdf"
     
        Set PDDoc = CreateObject("AcroExch.PDDoc")
        If PDDoc.Open(sChemin) Then
            Set JSO = PDDoc.GetJSObject
            If Not JSO Is Nothing Then
                ' Taille de la 1ere page (0)
                Set Page = PDDoc.AcquirePage(0)
                Set PageRect = Page.GetSize
                ' position icône
                Point(0) = 50
                Point(1) = PageRect.y - 50
                ' coordonnées/Taille popup
                PopupRect(0) = 200
                PopupRect(1) = PageRect.y - 200
                PopupRect(2) = 300
                PopupRect(3) = PageRect.y - 400
     
                ' nouveau commentaire
                Set Annot = JSO.AddAnnot
                Set Props = Annot.getProps
                Props.Type = "Text"
                Annot.setProps Props
     
                ' remplissage champs
                Set Props = Annot.getProps
                With Props
                    .Page = 0
                    .Point = Point
                    .PopupRect = PopupRect
                    .Author = "Triboulet"
                    .noteIcon = "Comment"
                    .strokeColor = JSO.Color.blue
                    .Contents = "Ajout depuis VBA"
                End With
                Annot.setProps Props
     
                Set Props = Nothing
                Set Annot = Nothing
                Set PageRect = Nothing
                Set Page = Nothing
                Set JSO = Nothing
            End If
            With PDDoc
                .Save 1, sCheminAjout
                .Close
            End With
        End If
        Set PDDoc = Nothing
    End Sub
    Téléchargement ici
    Images attachées Images attachées  
      0  0

Discussions similaires

  1. resultat sur un fichier excel,word,pdf
    Par harakatyouness dans le forum C#
    Réponses: 3
    Dernier message: 08/08/2007, 16h45
  2. convertir en pdf avec adobe VBA
    Par sophie.baron dans le forum Général VBA
    Réponses: 1
    Dernier message: 26/03/2007, 14h49
  3. Problème avec adobe acrobat reader
    Par Rabie de OLEP dans le forum Windows XP
    Réponses: 4
    Dernier message: 24/03/2007, 20h50
  4. Problème avec Adobe acrobat reader
    Par castelm dans le forum Autres Logiciels
    Réponses: 4
    Dernier message: 08/03/2007, 21h19
  5. Impression .PDF avec adobe
    Par popo68 dans le forum Access
    Réponses: 2
    Dernier message: 26/02/2007, 12h19

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