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. #221
    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 Ajout d'une image à un PDF
    Bonjour,

    Tout d'abord merci pour la réponse à mon message "Identifier le format de chaque page d'un PDF" (#218) : si elle répond tout à fait à la demande, l'utilisation d'Acrobat Pro est finalement problématique car l'outil sur lequel je travaille doit être utilisable par plusieurs dizaines d'utilisateurs (qu'il faudrait donc équiper dudit logiciel, pour un coût incompatible avec le besoin).

    Ceci m'a permis de constater que je n'avais pas détaillé la raison de ma demande : en effet, je souhaite apposer sur un PDF une image de signature et un champ texte, comme le permet Acrobat Reader (barre "Remplir et signer" dans la version DC) :
    Nom : Signature_Acrobat reader DC.png
Affichages : 3304
Taille : 18,2 Ko

    N'y étant pas parvenu, j'avais trouvé un moyen de superposer un deuxième PDF de format identique, contenant l'image et le texte (via PDFTK avec la fonction "stamp"). J'ai découvert depuis dans cette discussion que c'était également réalisable avec PDFCreator.
    Seulement, les PDFs à traiter peuvent être de différents formats, d'où ma demande précédente...

    D'où le retour à mon besoin initial : est-il possible d'ajouter une image à un PDF sans qu'elle soit ajustée audit PDF, via un outil gratuit !

    Merci d'avance pour votre aide

    Fabien
      0  0

  2. #222
    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
      0  0

  3. #223
    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
    Bonsoir,

    Merci encore une fois pour la rapidité de réponse.
    En effet, comme je l'écrivais plus haut, j'avais lu le message concernant l'utilisation de PDFCreator... et des limitations associées !

    Il va falloir que je trouve un plan B...

    Fabien
      0  0

  4. #224
    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 d'infos et métadonnées d'un fichier 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
    Option Explicit
     
    Sub SelectFichier()
    Dim Fichier As Variant
        ChDir ThisWorkbook.Path
     
        Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
     
        If Fichier <> False Then Infos (Fichier)
    End Sub
     
    Private Sub Infos(sFichier As String)
    Dim AcroApp As Object, AVDoc As Object, PDDoc As Object
    Dim sStr As String
     
        Set AcroApp = CreateObject("AcroExch.App")
        Set AVDoc = CreateObject("AcroExch.AVDoc")
     
        If AVDoc.Open(sFichier, Empty) Then
            If AVDoc.IsValid = False Then Exit Sub
            Set PDDoc = AVDoc.GetPDDoc()
            sStr = ""
            sStr = "Current pdf title : " & AVDoc.GetTitle()
            sStr = sStr & vbCrLf & "File Name : " & PDDoc.GetFileName()
            sStr = sStr & vbCrLf & "Number of Pages : " & PDDoc.GetNumPages()
            sStr = sStr & vbCrLf & "Flags : " & PDDoc.GetFlags()
            sStr = sStr & vbCrLf & "Instance ID : " & PDDoc.GetInstanceID()
            sStr = sStr & vbCrLf & "Page Mode : " & PDDoc.GetPageMode()
            sStr = sStr & vbCrLf & "Permanent ID : " & PDDoc.GetPermanentID()
            sStr = sStr & vbCrLf & "Language : " & AcroApp.GetLanguage()
            sStr = sStr & vbCrLf
            sStr = sStr & vbCrLf & "Title : " & PDDoc.GetInfo("Title")
            sStr = sStr & vbCrLf & "Creator : " & PDDoc.GetInfo("Creator")
            sStr = sStr & vbCrLf & "Keywords : " & PDDoc.GetInfo("Keywords")
            sStr = sStr & vbCrLf & "Subject : " & PDDoc.GetInfo("Subject")
            sStr = sStr & vbCrLf & "Author : " & PDDoc.GetInfo("Author")
            sStr = sStr & vbCrLf & "Created : " & PDDoc.GetInfo("CreationDate")
            sStr = sStr & vbCrLf & "Modified : " & PDDoc.GetInfo("ModDate")
            sStr = sStr & vbCrLf & "Producer : " & PDDoc.GetInfo("Producer")
        End If
     
        AcroApp.CloseAllDocs
        AcroApp.Exit
     
        Set PDDoc = Nothing
        Set AVDoc = Nothing
        Set AcroApp = Nothing
     
        MsgBox sStr
    End Sub
    Images attachées Images attachées  
      0  0

  5. #225
    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
    PDFCreator : Nombre de pages d'une liste de fichiers PDF
    Après Acrobat, RegExp

    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
    Option Explicit
     
    Sub Comptage_PDFCreator()
    Dim i As Long, LastRow As Long, sFichier As String
    Dim iNbTotal As Long
    Dim iNbPages As Long
     
        QueryPerformanceCounter Debut
        iNbTotal = 0
        LastRow = ShParam.Range("B" & Rows.Count).End(xlUp).Row
     
        For i = RDepart To LastRow
            sFichier = ShParam.Cells(1, 1) & "\" & ShParam.Cells(i, 2)
     
            iNbPages = NbPages_PDFCreator(sFichier)
     
            With ShParam
                .Cells(i, 3) = iNbPages
                iNbTotal = iNbTotal + iNbPages
                .Cells(1, 5) = iNbTotal
            End With
     
            Application.StatusBar = i & " / " & LastRow
            DoEvents
        Next i
     
        QueryPerformanceCounter Fin
        QueryPerformanceFrequency Freq
        Application.StatusBar = Format((Fin - Debut) / Freq, "0.00 s")
    End Sub
     
    Private Function NbPages_PDFCreator(ByVal sFichier As String)
    Dim pdf As Object
        Set pdf = CreateObject("pdfforge.pdf.pdf")
        NbPages_PDFCreator = pdf.NumberOfPages(sFichier)
        Set pdf = Nothing
    End Function
    Téléchargement ici

    Temps relevés pour 6100 fichiers.
    Images attachées Images attachées  
      0  0

  6. #226
    Membre confirmé Avatar de graphikris
    Homme Profil pro
    Pas tres doué
    Inscrit en
    Décembre 2012
    Messages
    1 214
    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 214
    Points : 522
    Points
    522
    Par défaut
    Bonjour,

    Je me suis aidé de ton post #7 (ici) pour essayer de créer une macro qui me permettrait d'envoyer en piéce jointe par mail via OUTLOOK, une feuille de mon classeur. Par contre aucune protection n'est nécessaire.

    Le nom du fichier a sauvegarder en Pdf est : synthese du processus (cellule A2 de ma feuille a envoyer en Pdf) extraction du jj_mm_aaaa à hh_mm.pdf.(ex: synthese du processus P187 _ Extraction du 23 04 2016 à 19h24.pdf)
    Mais je n'y arrive pas.
    Aurais tu une solution à me proposer ou un lien pour m'aider ?

    En te remerciant.
      0  0

  7. #227
    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 voir PDFCreator Génération PDF puis envoi par mail via CDO ( fonctionne si pas de proxy ), à combiner avec le Post 7

    Pour le nom de fichier jouer avec qqch comme
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Dim sNomFichier As String
        sNomFichier = "extraction du " & Format(Now, "dd_mm_yyyy") & " à " & Format(Now, "hh_mm_ss") & ".pdf"
      0  0

  8. #228
    Membre confirmé Avatar de graphikris
    Homme Profil pro
    Pas tres doué
    Inscrit en
    Décembre 2012
    Messages
    1 214
    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 214
    Points : 522
    Points
    522
    Par défaut
    Merci Kiki29,

    C'est en forgeant que l'on devient forgeron.
    J'ai trouvé mais pour Outlook, ce n'est pas comme dans ton post.
      0  0

  9. #229
    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, non car via CDO : indépendant du logiciel de mailing, envoi invisible pour ce dernier.
    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
     
    Private Sub EnvoiCDO(sNomFichier As String)
    Dim Msg As Object
    Dim Conf As Object
    Dim sBody As String
    Dim Flds As Variant
     
        Set Msg = CreateObject("CDO.Message")
        Set Conf = CreateObject("CDO.Configuration")
     
        Conf.Load -1
        Set Flds = Conf.Fields
        With Flds
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
            ' à adapter au contexte
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.xxxxx.fr"
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
            .Update
        End With
     
        sBody = "Test"
     
        With Msg
            Set .Configuration = Conf
            ' à adapter au contexte
            .To = "xxxxx@yyyyy.fr"
            .CC = ""
            .BCC = ""
            ' à adapter au contexte
            .From = """Triboulet"" <yyyyy@zzzzz.fr>"
            .Subject = "Test"
            .TextBody = sBody
            .AddAttachment sNomFichier
            .Send
        End With
     
        Set Msg = Nothing
        Set Conf = Nothing
    End Sub
     
    Sub EnvoiMail()
    Dim sNomFichierPdf As String
    Dim sDossier As String
    Dim FSO As Object
     
        sDossier = ThisWorkbook.Path
        sNomFichierPdf = sDossier & "\" & "extraction du " & _
                         Format(Now, "dd_mm_yyyy") & " à " & _
                         Format(Now, "hh_mm_ss") & ".pdf"
     
        Feuil1.ExportAsFixedFormat _
                Type:=xlTypePDF, _
                Filename:=sNomFichierPdf, _
                Quality:=xlQualityStandard, _
                IncludeDocProperties:=True, _
                IgnorePrintAreas:=False, _
                OpenAfterPublish:=False
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.fileExists(sNomFichierPdf) Then EnvoiCDO sNomFichierPdf
        Set FSO = Nothing
    End Sub
      0  0

  10. #230
    Membre confirmé Avatar de graphikris
    Homme Profil pro
    Pas tres doué
    Inscrit en
    Décembre 2012
    Messages
    1 214
    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 214
    Points : 522
    Points
    522
    Par défaut
    Mais c'est quoi : CDO
    Salut, non car via CDO ( indépendant du logiciel de mailing )
      0  0

  11. #231
    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, chez Microsoft ( en Anglais ) : CDO, autrement tu es apte à faire une recherche sur ce site ?
      1  0

  12. #232
    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 Envoi PDF par Mail via Outlook
    Re, je me réponds, via Outlook en Late Binding ( pas de référence à cocher )
    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
    Option Explicit
     
    Sub Tst_Outlook()
    Dim sChemin As String, AppOutlook As Object
    Dim OutlookItem As Object, ColAttach As Object
    Dim sNomFichierPdf As String
    Dim sDossier As String
    Dim FSO As Object
    Const olByValue = 1
     
        sDossier = ThisWorkbook.Path
        sNomFichierPdf = "extraction du " & _
                         Format(Now, "ddmmyyyy") & " à " & _
                         Format(Now, "hhmmss") & ".pdf"
     
        Feuil1.ExportAsFixedFormat _
                Type:=xlTypePDF, _
                Filename:=sDossier & "\" & sNomFichierPdf, _
                Quality:=xlQualityStandard, _
                IncludeDocProperties:=True, _
                IgnorePrintAreas:=False, _
                OpenAfterPublish:=False
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.fileExists(sDossier & "\" & sNomFichierPdf) Then
            Set AppOutlook = CreateObject("Outlook.Application")
            Set OutlookItem = AppOutlook.CreateItem(0)
            OutlookItem.To = "xxxxx@yyyyy.fr"
            OutlookItem.Subject = "Essai"
     
            OutlookItem.Body = "ça marche"
            Set ColAttach = OutlookItem.Attachments
            sChemin = sDossier & "\" & sNomFichierPdf
            ColAttach.Add sChemin, olByValue, 1, "Pièce jointe"
            OutlookItem.Display
     
            Set ColAttach= Nothing
            Set OutlookItem = Nothing
            Set AppOutlook = Nothing
        End If
        Set FSO = Nothing
    End Sub
      0  0

  13. #233
    Membre confirmé Avatar de graphikris
    Homme Profil pro
    Pas tres doué
    Inscrit en
    Décembre 2012
    Messages
    1 214
    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 214
    Points : 522
    Points
    522
    Par défaut
    Voici mon code, il pourra servir pour les futures recherches des internautes :
    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
    'Création du Pdf
                Dim sNomPdf As String
                Dim sDossier As String
                Dim Destinataire As String
     
                sDossier = ThisWorkbook.Path
     
                'ici l'adresse du destinataire se trouve sur la feuille 9 cellule B7
                Destinataire = Feuil9.Range("b7")
                'ici en cellule A2 de la feuille 9 se trouve un renseignement a rajouter au nom du fichier Pdf à enregistrer
                sNomPdf = sDossier & "\" & "Remplacer ici par nom du Pdf" & Feuil9.Range("A2") & " _ Extraction du " & _
                          Replace(Replace(Replace(Left(Now, 16), ":", "h"), " ", " à "), "/", "-") & ".pdf"
     
                Feuil9.ExportAsFixedFormat _
                        Type:=xlTypePDF, _
                        Filename:=sNomPdf, _
                        Quality:=xlQualityStandard, _
                        IncludeDocProperties:=True, _
                        IgnorePrintAreas:=False, _
                        OpenAfterPublish:=False
     
                'Envoi du mail
     
                'Contrôler dans Visual Basic/Outils/Références/que Microsoft Outlook --,- Object Librairy est bien coché
                Dim olapp As Outlook.Application
                'Contrôle la validité ou la présence d'adresse mail en B7
                Dim msg As MailItem
                Set olapp = New Outlook.Application
                Set msg = olapp.CreateItem(olMailItem)
                'Adresse de la cellule contenant la liste des adresses mails
                msg.To = Range("B7").Value
                'Saisir le sujet de l'envoi + ici se rajouter une info de la cellule A2
                msg.Subject = "remplacer ici par le sujet du mail" & Feuil9.Range("A2")
                'Saisie du message
                'Saisir Corps du message
                msg.Body = "Inscrire ici votre corps de msg." & Chr(13) & Chr(13) & "Permet de passer a la ligne." & Chr(13) & Chr(13) & "Passage a la ligne." & Chr(13) & Chr(13) & Chr(13) & "Ci-joint inscrire le nom type de document." & Chr(13) & Chr(13) & Chr(13) & "Formule de politesse," & Chr(13) & "Nom de l'expéditeur."
     
                'Adresse de la pièce jointe
                msg.Attachments.Add Source:=sNomPdf
     
                msg.Display
                'Transmission du message
                msg.Send
      0  1

  14. #234
    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 PDFCreator 2.X +
    A titre documentaire ( tiré d'un exemple VBS ) un échantillon en version 2.x

    De très nombreuses méthodes/propriétés ne sont plus accessibles ( versions payantes obligent ? ) par rapport à la version 1.7.3


    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
     
    Option Explicit
     
    Sub Tst_Background()
    Dim oShell As Object, PDFCreatorQueue As Object
    Dim sCheminOut As String, printJob As Object, FSO As Object
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        Set oShell = CreateObject("Shell.Application")
        Set PDFCreatorQueue = CreateObject("PDFCreator.JobQueue")
     
        sCheminOut = ThisWorkbook.Path & "\" & "Sortie.pdf"
     
        PDFCreatorQueue.Initialize
     
        oShell.ShellExecute "RUNDLL32.exe", "PRINTUI.DLL,PrintUIEntry /k /n ""PDFCreator""", "", "open", 1
     
        If Not PDFCreatorQueue.WaitForJob(10) Then
            Application.StatusBar = "File d'impression vide après " & " 10 secondes"
        Else
            Set printJob = PDFCreatorQueue.NextJob
     
            printJob.SetProfileByGuid ("DefaultGuid")
            printJob.SetProfileSetting "BackgroundPage.Enabled", "true"
            printJob.SetProfileSetting "BackgroundPage.Repetition", "RepeatAllPages"
            printJob.SetProfileSetting "BackgroundPage.File", ThisWorkbook.Path & "\" & "Background.pdf"
            printJob.ConvertTo (sCheminOut)
     
            If (Not printJob.IsFinished Or Not printJob.IsSuccessful) Then
                Application.StatusBar = "Conversion impossible du fichier : " & sCheminOut
            Else
                Application.StatusBar = "Terminé avec succès"
            End If
        End If
     
        PDFCreatorQueue.ReleaseCom
        Set oShell = Nothing
        Set FSO = Nothing
    End Sub
      0  0

  15. #235
    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 Visualisation d'un fichier PDF dans une UserForm via IExplorer
    En remplacement de : Visualisation d'un fichier PDF dans une UserForm via le Reader
    Remarques :
    • fonctionnait avec le Reader 11.0.06
    • se vautrait avec le Reader 11.0.07 et 11.0.8
    • refonctionnait avec le Reader 11.0.09
    • puis à nouveau hs depuis le 11.0.12 etc.
    1ere façon :
    Dans un module VBA standard
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Option Explicit
     
    Public Fichier As Variant
     
    Sub SelectPDF()
        ChDir ThisWorkbook.Path & "\"
        Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
        If Fichier <> False Then UserForm1.Show
    End Sub
    ● Affecter un bouton à la procédure SelectPDF

    Dans une UserForm via un contrôle Microsoft WebBrowser
    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
    Option Explicit
     
    Private Sub UserForm_Initialize()
        With UserForm1
            .Height = 600
            .Width = 600
        End With
        With WebBrowser1
            .Left = 5
            .Top = 5
            .Width = UserForm1.Width - 10
            .Height = UserForm1.Height - 35
        End With
        WebBrowser1.Navigate Fichier
    End Sub
    2eme façon :
    Dans un module VBA standard
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    Option Explicit
     
    Public Fichier As Variant
     
    Sub SelectPDF()
        ChDir ThisWorkbook.Path & "\"
        Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
        If Fichier <> False Then UserForm1.Show
    End Sub
    ● Affecter un bouton à la procédure SelectPDF

    Dans une UserForm vierge
    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
    Option Explicit
     
    Private Sub UserForm_Initialize()
    Dim WB As Object
        With UserForm1
            .Height = 600
            .Width = 600
        End With
     
        Set WB = UserForm1.Controls.Add("Shell.Explorer.2", "x", True)
        With WB
            .Left = 5
            .Top = 5
            .Width = UserForm1.Width - 10
            .Height = UserForm1.Height - 35
        End With
     
        WB.Navigate Fichier
        Set WB = Nothing
    End Sub
    Accessoirement en remplaçant
    WebBrowser1.Navigate Fichier
    par
    WebBrowser1.Navigate Fichier & "#zoom=250&page=3&toolbar"
    on obtient un zoom de 250 % sur la 3eme page avec affichage de la barre d'outils.
    Sinon normalement une barre d'outils apparait fugitivement où le zoom +/- est dispo.

    Téléchargement : ici
    Images attachées Images attachées  
      1  0

  16. #236
    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 Visualisation d'un fichier PDF dans une UserForm via IExplorer ( suite )
    Pour permettre de résoudre le pb quand on charge un fichier pdf sans fermer l'UserForm ( vbModeless ), il faut rajouter une TextBox.

    Dans un module VBA standard
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Option Explicit
     
    Sub SelectPDF()
    Dim Fichier As Variant
     
        ChDir ThisWorkbook.Path & "\"
        Fichier = Application.GetOpenFilename("Fichier PDF (*.pdf), *.pdf")
        If Fichier <> False Then
            With UserForm1
                .TextBox1.Text = Fichier
                .Show vbModeless
            End With
        End If
    End Sub
    • Affecter un bouton à la procédure SelectPDF

    Dans une UserForm
    • Ajouter un contrôle Microsoft WebBrowser
    • Ajouter un contrôle TextBox
    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
    Option Explicit
     
    Private Sub UserForm_Initialize()
        With UserForm1
            .Width = 640
            .Height = 480
        End With
        With WebBrowser1
            .Left = 5
            .Top = 5
            .Width = UserForm1.Width - 10
            .Height = UserForm1.Height - 35
        End With
    End Sub
     
    Private Sub Textbox1_Change()
        WebBrowser1.Navigate TextBox1.Text & "#zoom=250%&page=3&toolbar"
    End Sub
    Pour info : Parameters for Opening PDF Files

    Téléchargement : ici
      1  0

  17. #237
    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 Visualisation d'une liste de fichiers PDF dans une UserForm via IExplorer
    Cette liste de fichiers peut être récursive ou non à partir d'un dossier racine, elle peut être triée ou pas.

    La mise en place des composants ( taille/position/propriétés ) se fera dans UserForm_Initialize.

    Créer une feuille
    • Insérer un bouton

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Option Explicit
     
    Sub Bouton1_QuandClic()
        UserForm1.Show
    End Sub
    Créer une UserForm
    • Insérer un composant Microsoft Webbrowser WebBrowser1
    • un composant Listbox ListBox1
    • 2 Textboxes Textbox1 Textbox2
    • 2 Checkboxes chkRecur et chkTri
    • 2 CommandButtons CommandButton1 CommandButton2 dénommés "Ouvrir" et "Sélection Dossier"

    Code UserForm
    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
    Option Explicit
     
    Private Declare Function QueryPerformanceCounter Lib "kernel32" (x As Currency) As Boolean
    Private Declare Function QueryPerformanceFrequency Lib "kernel32" (x As Currency) As Boolean
     
    Dim Debut As Currency, Fin As Currency, Freq As Currency
    Dim iCpt As Long
     
    Private Sub CommandButton1_Click()
    Dim sFichier As String, WsShell As Object
        sFichier = Me.TextBox1
        If Len(sFichier) = 0 Then Exit Sub
        Set WsShell = CreateObject("WScript.Shell")
        WsShell.Run "AcroRd32 " & sFichier
        Set WsShell = Nothing
    End Sub
     
    Private Sub CommandButton2_Click()
    Dim sChemin As String
    Dim sStr As String
     
        sChemin = ThisWorkbook.Path & "\"
     
        With Application.FileDialog(msoFileDialogFolderPicker)
            .InitialFileName = sChemin
            .Title = "Sélectionner le Dossier Racine"
            .AllowMultiSelect = False
            .InitialView = msoFileDialogViewDetails
            .ButtonName = "Sélection Dossier"
            .Show
            If .SelectedItems.Count > 0 Then
                iCpt = 0
                TextBox2 = ""
                DoEvents
                QueryPerformanceCounter Debut
                With Me
                    .WebBrowser1.Navigate "http://about.blank"
                    .TextBox1 = ""
                    .ListBox1.Clear
                    .ListBox1.ColumnCount = 2
                    .ListBox1.ColumnWidths = "400;0"
                End With
                Liste .SelectedItems(1), Me.chkRecur.Value
                If chkTri Then Tri_Listbox
                QueryPerformanceCounter Fin
                QueryPerformanceFrequency Freq
                sStr = Format((Fin - Debut) / Freq, "0.00 s")
                TextBox2 = TextBox2 & " / " & sStr
            End If
        End With
    End Sub
     
    Private Sub ListBox1_Click()
        Me.TextBox1 = ListBox1.Column(1) & "\" & ListBox1.List(ListBox1.ListIndex)
    End Sub
     
    Private Sub Liste(sChemin As String, bSousDossier As Boolean)
    Dim FSO As Object, Dossier As Object, Fichier As String
     
        Set FSO = CreateObject("Scripting.FileSystemObject")
        Set Dossier = FSO.GetFolder(sChemin)
     
        Fichier = Dir$(sChemin & "\*.*")
     
        Do While Len(Fichier) > 0
            If UCase$(FSO.GetExtensionName(Fichier)) Like ("PDF") Then
                With Me.ListBox1
                    .AddItem Fichier
                    .List(iCpt, 0) = Fichier
                    .List(iCpt, 1) = sChemin
                    iCpt = iCpt + 1
                    TextBox2 = iCpt
                    DoEvents
                End With
            End If
            Fichier = Dir$()
        Loop
     
        If bSousDossier Then
            For Each Dossier In Dossier.SubFolders
                Liste Dossier.Path, True
            Next Dossier
        End If
     
        Set FSO = Nothing
    End Sub
     
    Private Sub Textbox1_Change()
        WebBrowser1.Navigate TextBox1.Text & "#zoom=100%&page=1&toolbar=1"
    End Sub
     
    Private Sub Tri_Listbox()
    Dim i As Long
    Dim j As Long
    Dim sTemp As String
    Dim sTemp2 As String
    Dim LbList As Variant
     
        LbList = Me.ListBox1.List
     
        For i = LBound(LbList, 1) To UBound(LbList, 1) - 1
            For j = i + 1 To UBound(LbList, 1)
                If UCase$(LbList(i, 0)) > UCase$(LbList(j, 0)) Then
                    sTemp = LbList(i, 0)
                    LbList(i, 0) = LbList(j, 0)
                    LbList(j, 0) = sTemp
     
                    sTemp2 = LbList(i, 1)
                    LbList(i, 1) = LbList(j, 1)
                    LbList(j, 1) = sTemp2
                End If
            Next j
        Next i
     
        With Me
            .ListBox1.Clear
            .ListBox1.List = LbList
        End With
    End Sub
     
    Private Sub UserForm_Initialize()
        With UserForm1
            .Width = 640
            .Height = 480
        End With
        With ListBox1
            .Left = 5
            .Top = 5
            .Width = UserForm1.Width / 3 - 10
            .Height = UserForm1.Height - 73
            .IntegralHeight = False
        End With
        With WebBrowser1
            .Left = ListBox1.Left + ListBox1.Width + 5
            .Top = 5
            .Width = 2 * UserForm1.Width / 3 - 8
            .Height = UserForm1.Height - 73
        End With
     
        With CommandButton2
            .Left = 5
            .Top = UserForm1.Height - 60
            .Width = 90
            .Height = 30
        End With
        With CommandButton1
            .Left = 2 * UserForm1.Width / 3
            .Top = UserForm1.Height - 60
            .Width = 90
            .Height = 30
        End With
     
        With chkRecur
            .Left = CommandButton2.Left + CommandButton2.Width + 5
            .Top = UserForm1.Height - 60
            .Width = 65
            .Height = 30
        End With
        With chkTri
            .Left = chkRecur.Left + chkRecur.Width + 5
            .Top = chkRecur.Top
            .Width = 45
            .Height = 30
        End With
        With TextBox2
            .Left = chkTri.Left + chkTri.Width + 5
            .Top = UserForm1.Height - 55
            .Width = 40
            .Height = 18
            .BackStyle = fmBackStyleTransparent
        End With
    End Sub
    Pour info : Parameters for Opening PDF Files
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    Private Sub Textbox1_Change()
        WebBrowser1.Navigate TextBox1.Text & "#zoom=100%&page=1&toolbar"
        'WebBrowser1.Navigate TextBox1.Text & "#zoom=100%&view=FitH&page=1&toolbar"
        'WebBrowser1.Navigate TextBox1.Text & "#zoom=100%&view=Fit&page=1&toolbar"
    End Sub
    Téléchargement : ici
    Images attachées Images attachées  
      1  0

  18. #238
    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écoupage d'un fichier Pdf en fichiers unitaires

    A placer dans un module standard
    Affecter un bouton à la procédure SelFichier
    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
    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
     
    Private Function CreationDossier(sDossier) As Long
    Dim Rep As Long
        Rep = SHCreateDirectoryEx(0&, sDossier, 0&)
    End Function
     
    Private Sub DecoupagePDF(sFichier As String)
    Dim PDDoc As Object
    Dim oPDF As Object
    Dim iNumPage As Long, sNom As String
    Dim i As Long, sDossier As String
     
        sDossier = ThisWorkbook.Path & "\" & "Split"
        CreationDossier sDossier
     
        Set PDDoc = CreateObject("AcroExch.pdDoc")
     
        If PDDoc.Open(sFichier) Then
            iNumPage = PDDoc.GetNumPages
            For i = 0 To iNumPage - 1
                Set oPDF = CreateObject("AcroExch.PDDoc")
                oPDF.Create
                sNom = "Page_" & Format(i + 1, "000") & ".pdf"
                With oPDF
                    .InsertPages -1, PDDoc, i, 1, 0
                    .Save 1, sDossier & "\" & sNom
                    .Close
                End With
                Set oPDF = Nothing
                Application.StatusBar = i + 1 & " / " & iNumPage
            Next i
        End If
     
        Set PDDoc = Nothing
    End Sub
     
    Sub SelFichier()
        With Application.FileDialog(msoFileDialogFilePicker)
            .InitialFileName = ThisWorkbook.Path & "\"
            .Title = "Sélectionner un Fichier"
            .Filters.Clear
            .Filters.Add "PDF", "*.pdf", 1
            .AllowMultiSelect = False
            .InitialView = msoFileDialogViewDetails
            .ButtonName = "Sélection Fichier"
            .Show
            If .SelectedItems.Count > 0 Then
                DoEvents
                DecoupagePDF .SelectedItems(1)
            End If
        End With
    End Sub
    Images attachées Images attachées  
      0  0

  19. #239
    Membre à l'essai
    Femme Profil pro
    Comptable
    Inscrit en
    Décembre 2015
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 36
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Comptable

    Informations forums :
    Inscription : Décembre 2015
    Messages : 16
    Points : 14
    Points
    14
    Par défaut Complément d'information
    Citation Envoyé par kiki29 Voir le message
    PDFCreator Ajout de Texte, Ligne et Hirondelles sur un Document Pdf

    Merci pour tous les codes VBA concernant PDFCreator, ils me sont très utiles.
    Je travaille en réseau et le code ci-dessous enregistre le fichier dans Mes Documents ce qui me pose problème.
    Je ne vois pas où rajouter le chemin d'enregistrement.

    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
    Option Explicit
     
    Sub Tst_AjoutTexteLigneHirondelles()
    Dim pdf As Object, pdfText As Object, pdfLine As Object, pdfLine2 As Object
    Dim sNomDoc As String
     
        Set pdf = CreateObject("pdfforge.pdf.pdf")
        Set pdfText = CreateObject("pdfforge.pdf.pdfText")
     
     
        sNomDoc = ThisWorkbook.Path & "\" & "Document.pdf"
     
        With pdfText
            .fillOpacity = 1
     
            .FontColorBlue = 62
            .FontColorGreen = 125
            .FontColorRed = 255
     
            .FontName = "comic.TTF"
            .FontSize = 55
            .Rotation = 45
            .Text = "Essai Essai Essai Essai Essai"
            .XPosition = 25
            .YPosition = 100
     
            'Public Function AddTextToPDFFile( _
             '    sourceFilename As String, _
             '    destinationFilename As String, _
             '    fromPage As Integer, _
             '    toPage As Integer, _
             '    ByRef textObject As pdfText _
             ') As Integer
     
            pdf.AddTextToPDFFile sNomDoc, "AddText.pdf", 1, 1, pdfText
        End With
     
     
     
        Set pdfText = Nothing
        Set pdf = Nothing
    End Sub
      0  0

  20. #240
    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, pourtant toutes les infos sont là à dessein :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
            'Public Function AddTextToPDFFile( _
             '    sourceFilename As String, _
             '    destinationFilename As String, _
             '    fromPage As Integer, _
             '    toPage As Integer, _
             '    ByRef textObject As pdfText _
             ') As Integer
    En remplaçant :
    pdf.AddTextToPDFFile sNomDoc, "AddText.pdf", 1, 1, pdfText
    par qqch comme ceci par exemple :
    pdf.AddTextToPDFFile sNomDoc, ThisWorkbook.Path & "\" & "AddText.pdf", 1, 1, pdfText

    Après n'ayant pas de réseau à dispo ......
    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