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

Delphi Discussion :

Exportation de fichier texte en pdf


Sujet :

Delphi

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif
    Avatar de diden138
    Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    714
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2006
    Messages : 714
    Par défaut Exportation de fichier texte en pdf
    Bonjour je cherche un composant gratuit pour exporter mes ficheir texte en pdf ..

  2. #2
    Membre confirmé
    Inscrit en
    Mars 2005
    Messages
    129
    Détails du profil
    Informations forums :
    Inscription : Mars 2005
    Messages : 129
    Par défaut
    Je l'ai jamais utilise avec Delphi mais tu as PDFCreator qui utilise une imprimante virtuelle pour generer un pdf a partir de n'importe quel type de document imprimable.

    Il est pilotable par objet COM, donc depuis Delphi.

  3. #3
    Membre très actif
    Avatar de diden138
    Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    714
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2006
    Messages : 714
    Par défaut Re :
    Mais il n'est plus gratuit d'aprés ce lien il y'a juste une demo http://www.colorpilot.com/pdflibrary.html

  4. #4
    Membre très actif
    Avatar de diden138
    Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    714
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2006
    Messages : 714
    Par défaut Re :
    Quelqun pourait-il m'aider comment travailler avec pd creator j'ai cherché partout il ny'a pas de tuto

  5. #5
    Membre confirmé
    Inscrit en
    Mars 2005
    Messages
    129
    Détails du profil
    Informations forums :
    Inscription : Mars 2005
    Messages : 129
    Par défaut
    Desole j'ai pas d'exemple de code avec Delphi sous la main, je te file un exemple que j'ai eu a faire pour une macro excel en VBA. Il faut donc que tu rajoutes un activeX (pdfcreator.exe) a ton projet Delphi. Pour le reste essaye de t'inspirer de mon exemple. Je suppose qu'il doit falloir de la meme facon redefinir les fonctions eError et eReady. Bonne chance :p

    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
    Option Explicit
     
    Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
    ' Add a reference to PDFCreator
    Private WithEvents PDFCreator1 As PDFCreator.clsPDFCreator
     
    Function imprimeFeuille(ByVal f As String) As Boolean
        Dim sauveprinter, nomPrinter As String
        Dim fs
        Dim i As Integer
     
        Set PDFCreator1 = New clsPDFCreator
     
        If PDFCreator1.cProgramIsRunning() Then
            ''Si PDFCreator est deja en cours, on recupere l'instance en cours
            If PDFCreator1.cStart("/NoProcessingAtStartup", True) = False Then
                imprimeFeuille = False
                Exit Function
            End If
        ''Sinon on en demarre une
        ElseIf PDFCreator1.cStart("/NoProcessingAtStartup") = False Then
                imprimeFeuille = False
                Exit Function
        End If
     
        With PDFCreator1
            .cPrinterStop = True
     
            ''On vide les autres impressions en attente
            Do While .cCountOfPrintjobs() <> 0
                .cDeletePrintjob (1)
            Loop
            .cReadOptionsFromFile (ThisWorkbook.Path + "\pdf.ini")
            .cOption("UseAutosave") = 1
            .cOption("UseAutosaveDirectory") = 1
            .cOption("AutosaveFilename") = nomFichier
            .cOption("AutosaveDirectory") = nomRep
            .cOption("AutosaveFormat") = 0 ''0 = PDF
            .cClearCache
        End With
     
        sauveprinter = Application.ActivePrinter
        For i = 0 To 9
            nomPrinter = "PDFCreator sur Ne0" & i & ":"
            On Error Resume Next
            Application.ActivePrinter = "PDFCreator sur Ne0" & i & ":"
            If ActivePrinter = nomPrinter Then Exit For
        Next
     
        Worksheets(f).Visible = True
        Worksheets(f).PrintOut Copies:=1
        Worksheets(f).Visible = False
     
        Do Until PDFCreator1.cCountOfPrintjobs = 1
            DoEvents
            Sleep 300
        Loop
     
        Sleep 300
     
        PDFCreator1.cPrinterStop = False
     
        i = 0
        Do Until PDFCreator1.cPrinterStop = True Or i > 10
            DoEvents
            Sleep 300
     
            i = i + 1
        Loop
     
        PDFCreator1.cCloseRunningSession
     
        Application.ActivePrinter = sauveprinter
     
        imprimeFeuille = Dir(nomRep + nomFichier) <> ""
    End Function
     
    Private Sub PDFCreator1_eError()
     MsgBox ("ERROR [" & PDFCreator1.cErrorDetail("Number") & "]: " & PDFCreator1.cErrorDetail("Description"))
    End Sub
     
    Private Sub PDFCreator1_eReady()
     PDFCreator1.cPrinterStop = True
    End Sub

  6. #6
    Membre très actif
    Avatar de diden138
    Profil pro
    Développeur Web
    Inscrit en
    Mai 2006
    Messages
    714
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Mai 2006
    Messages : 714
    Par défaut Re :
    D'ou j'importe cet active x

Discussions similaires

  1. Réponses: 2
    Dernier message: 11/02/2008, 15h07
  2. Automatisation d'exportation en fichier texte d'une partie d'un fichier
    Par Alqualonde dans le forum Macros et VBA Excel
    Réponses: 15
    Dernier message: 12/10/2007, 09h37
  3. Export en fichier texte
    Par popo68 dans le forum Access
    Réponses: 4
    Dernier message: 06/03/2007, 11h08
  4. Problème à l'exportation sous fichier texte
    Par Drozo dans le forum Access
    Réponses: 2
    Dernier message: 04/09/2006, 15h45
  5. Export vers fichier text
    Par Aurèl90 dans le forum Access
    Réponses: 10
    Dernier message: 26/10/2005, 10h26

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