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

VB 6 et antérieur Discussion :

[VB6] Editer les options de PDFCreator


Sujet :

VB 6 et antérieur

  1. #1
    Candidat au Club
    Inscrit en
    Janvier 2007
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 4
    Points : 2
    Points
    2
    Par défaut [VB6] Editer les options de PDFCreator
    Bonjour,

    J'ai une application qui actuellement envoie directement des données formattées à l'impression. On choisi alors le type d'imprimante grace à un CommonDialog.

    Seulement on a aussi la possibilité d'envoyer l'impression vers une impirmante virtuelle telle que PDFCreator. Jusque là tout fonctionne correctement.

    On souhaiterai configurer PDFCreator en automatique ainsi que le nom de fichier généré.

    J'ai déjà regardé ce fil ainsi que ceux auquels il fait référence.
    http://www.developpez.net/forums/sho...d.php?t=211931

    Seulement, je n'ai pas réussi à règler mon problème.

    Merci d'avance,

    Nemo

  2. #2
    Membre éclairé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 730
    Points : 876
    Points
    876
    Par défaut
    Bonjour,

    Citation Envoyé par EvilNemo
    Seulement, je n'ai pas réussi à règler mon problème.
    Qui est ?

  3. #3
    Candidat au Club
    Inscrit en
    Janvier 2007
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Pouvoir éditer les options d'impression de PDF Creator, sachant que je n'arrive pas à récupérer l'objet clsPDFCreator qui correspond au travail d'impression commandé par le CommonDialog

  4. #4
    Membre éclairé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    730
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 730
    Points : 876
    Points
    876
    Par défaut
    Bon, on va pas jouer aux devinettes, c'est très clair dans l'exemple,

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    ' Instanciation de l'objet clsPDFCreatorOptions avec les options par défaut
    Set opt = PDFCreator1.cOptions
     
        With opt
            '/ Répertoire de sortie
            .AutosaveDirectory = Trim$(NomDir)
            '/ Fichier de sortie
            .AutosaveFilename = Trim$(NomFichier)
            .UseAutosave = 1
            .UseAutosaveDirectory = 1
            '/ format de sortie (0 = PDF)
            .AutosaveFormat = 0
        End With

    donc si tu bloques, montre déjà ce que tu as comme code

  5. #5
    Candidat au Club
    Inscrit en
    Janvier 2007
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Je conçois que ça ne soit pas très clair mais c'est pas évident à expliquer.

    Voici le code que j'utlise pour définir l'imprimante sur laquelle je vais envoyer mes données morceau par morceau. Cette dernière attend l'instruction "fin de page" pour imprimer. Ce code éxistait déjà dans l'application qu'on m'a demandé de modifier. On veut juste pouvoir y incorporer les options de PDFCreator (dans le cas où on utilise l'imprimante virtuelle PDFCreator) telles que le choix du mode automatique du nom de fichier généré, du dossier où les fichiers générés seront stockés etc...

    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
     
    Public Function ShowPrinter(frmOwner As Form, _
        Optional PrintFlags As Integer) As Boolean
     
        Dim PrintDlg As PRINTDLG_TYPE
        Dim DevMode As DEVMODE_TYPE
        Dim DevName As DEVNAMES_TYPE
     
        Dim lpDevMode As Long, lpDevName As Long
        Dim bReturn As Integer
        Dim objPrinter As Printer, NewPrinterName As String
        Dim strSetting As String
     
        Dim bFlagOk As Boolean
     
        ' Use PrintDialog to get the handle to a memory
        ' block with a DevMode and DevName structures
     
        PrintDlg.lStructSize = Len(PrintDlg)
        PrintDlg.hwndOwner = frmOwner.hwnd
     
        PrintDlg.flags = PrintFlags
     
        'Set the current orientation and duplex setting
        DevMode.dmDeviceName = Printer.DeviceName
        DevMode.dmSize = Len(DevMode)
        DevMode.dmFields = DM_ORIENTATION Or DM_DUPLEX
        DevMode.dmOrientation = Printer.Orientation
        On Error Resume Next
        DevMode.dmDuplex = Printer.Duplex
        On Error GoTo 0
     
        'Allocate memory for the initialization hDevMode structure
        'and copy the settings gathered above into this memory
        PrintDlg.hDevMode = GlobalAlloc(GMEM_MOVEABLE Or _
           GMEM_ZEROINIT, Len(DevMode))
        lpDevMode = GlobalLock(PrintDlg.hDevMode)
        If lpDevMode > 0 Then
            CopyMemory ByVal lpDevMode, DevMode, Len(DevMode)
            bReturn = GlobalUnlock(PrintDlg.hDevMode)
        End If
     
        'Set the current driver, device, and port name strings
        With DevName
            .wDriverOffset = 8
            .wDeviceOffset = .wDriverOffset + 1 + Len(Printer.DriverName)
            .wOutputOffset = .wDeviceOffset + 1 + Len(Printer.Port)
            .wDefault = 0
        End With
        With Printer
            DevName.extra = .DriverName & Chr(0) & _
            .DeviceName & Chr(0) & .Port & Chr(0)
        End With
     
        'Allocate memory for the initial hDevName structure
        'and copy the settings gathered above into this memory
        PrintDlg.hDevNames = GlobalAlloc(GMEM_MOVEABLE Or _
            GMEM_ZEROINIT, Len(DevName))
        lpDevName = GlobalLock(PrintDlg.hDevNames)
        If lpDevName > 0 Then
            CopyMemory ByVal lpDevName, DevName, Len(DevName)
            bReturn = GlobalUnlock(lpDevName)
        End If
     
        'Call the print dialog up and let the user make changes 
        bFlagOk = PrintDialog(PrintDlg)
        If bFlagOk Then
     
            'First get the DevName structure.
            lpDevName = GlobalLock(PrintDlg.hDevNames)
                CopyMemory DevName, ByVal lpDevName, 45
            bReturn = GlobalUnlock(lpDevName)
            GlobalFree PrintDlg.hDevNames
     
            'Next get the DevMode structure and set the printer
            'properties appropriately
            lpDevMode = GlobalLock(PrintDlg.hDevMode)
                CopyMemory DevMode, ByVal lpDevMode, Len(DevMode)
            bReturn = GlobalUnlock(PrintDlg.hDevMode)
            GlobalFree PrintDlg.hDevMode
            NewPrinterName = UCase$(Left(DevMode.dmDeviceName, _
                InStr(DevMode.dmDeviceName, Chr$(0)) - 1))
            If UCase$(Printer.DeviceName) <> NewPrinterName Then
                For Each objPrinter In Printers
                   If UCase$(objPrinter.DeviceName) = NewPrinterName Then
                        Set Printer = objPrinter
                   End If
                Next
            End If
            On Error Resume Next
     
            'Set printer object properties according to selections made
            'by user
            With Printer
                .Copies = DevMode.dmCopies
                .Duplex = DevMode.dmDuplex
                .Orientation = DevMode.dmOrientation
                .Papersize = DevMode.dmPaperSize
            End With
            On Error GoTo 0
        End If  
     
     
       ShowPrinter = bFlagOk
    End Function
    Le code en lui même est assez incompréhensible et mal commenté... Je le poste juste pour que vous ayez une meilleure idée de ce que je veux faire. Sinon tant pis je chercherai par moi même.

  6. #6
    Membre expert
    Avatar de Delbeke
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    2 675
    Détails du profil
    Informations personnelles :
    Âge : 70
    Localisation : France

    Informations forums :
    Inscription : Juillet 2006
    Messages : 2 675
    Points : 3 696
    Points
    3 696
    Par défaut
    Je ne pense pas que tu puisses y arriver avec les api de windows. Le cas de PdfCreator est assez compliqué. On y utilise un redirecteur de Port (RedMon) qui transfere ce qui est envoyé vers l'imprimante vers un IO Standard , ce dernier lance egalement un executable (pdfcreator) qui prend en charge ce IO Standard, pour l'envoyer a ghostscript , le driver d'imprimante est un driver PostScript.
    Tout çà est assez usine a gaz et ce n'est pas en attaquant le driver d'imprimante que tu régleras ce que fait PdfCreator, essaye de voir plutot du coté de l'objet PdfCreator comme le suggére Phifi
    En général, on ne demande de conseils que pour ne pas les suivre ou, si on les a suivis, reprocher à quelqu'un de les avoir donnés
    (ALEXANDRE DUMAS)

    N'hésitez pas à visiter ma page de contributions

  7. #7
    Candidat au Club
    Inscrit en
    Janvier 2007
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Merci beaucoup, tu m'as mis sur une piste. Je suis en train de regarder les sources de PDFCreator 0_9_3 et visiblement il y a un exemple fourni avec qui m'interesse beaucoup.

    Encore merci à tous les deux.

    Bonne journée

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [VB6]Enumérer les attributs et les méthodes d'une classe
    Par HPJ dans le forum VB 6 et antérieur
    Réponses: 7
    Dernier message: 04/05/2004, 18h34
  2. [VB6]manipuler les semaines en VB ?
    Par kamadji dans le forum VB 6 et antérieur
    Réponses: 7
    Dernier message: 02/05/2003, 12h33
  3. [VB6] [Langage] VB6 et les appels de dll
    Par Dave63 dans le forum VB 6 et antérieur
    Réponses: 7
    Dernier message: 16/01/2003, 18h20
  4. Vous gerez comment les options d'un programme?
    Par n0n0 dans le forum C++Builder
    Réponses: 5
    Dernier message: 17/05/2002, 13h21

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