access transformer un etat en pdf via vb

access transformer un etat en pdf via vb - VB/VBA/VBS - Programmation

Marsh Posté le 28-07-2003 à 14:26:46    

Voila je cherche a creer un pdf a partir d'un etat pour pouvoir l'envoyer par e-mail, sans perte de mise en page.
 
j'ai acrobat writer d'installer sur la machine.

Reply

Marsh Posté le 28-07-2003 à 14:26:46   

Reply

Marsh Posté le 06-08-2003 à 10:37:24    


Appelle SetPrinter avec le nom de ton imprimante, puis SetPDFFile. Si c'est ok, tu peux lancer ton impression depuis Access, et le PDF sera créé avec le nom que tu as choisi.
 
 
'------------------------
 
Private Declare Function ExtEscape Lib "gdi32" ( _
                                                    ByVal hdc As Long, _
                                                    ByVal nEscape As Long, _
                                                    ByVal cbInput As Long, _
                                                    lpszInData As Any, _
                                                    ByVal cbOutput As Long, _
                                                    ByVal lpszOutData As String _
                                                ) As Long
 
Private Const PDFFILENAME = 4312
Private Const PDFINPUT_OK = 1
Private Const PDFINPUT_FAIL = -1
 
Private Function SetPrinter(ByVal PrinterName As String) As Boolean
    Dim i As Long
 
    SetPrinter = False
    For i = 0 To Printers.Count - 1
        If Printers(i).DeviceName = PrinterName Then
            Set Printer = Printers(i)
            SetPrinter = True
            Exit For
        End If
    Next i
End Function
 
Private Function SetPDFFile(FileName As String) As Boolean
    'A note on specifying the metadata in a PDF file.***
    'Although it is possible to set the creation date, modification
    'date, creator and producer using the above structure, we do not
    'suggest that you do so. If you leave these blank PDF Writer will
    'fill in appropriate values. If you set the date yourself and it
    'does not meet the PDF specification it may cause trouble for readers
    'of the PDF. PDFWriter will set the appropriate date using the system
    'clock, use the application name from the DOCINFO struct and set itself
    'as the producer
     
    Dim PDFWriterProperties As PDFInput
     
    PDFWriterProperties.outputfilename = FileName + Chr$(0)
    PDFWriterProperties.docinfo.title = Chr$(0)
    PDFWriterProperties.docinfo.author = Chr$(0)
    PDFWriterProperties.docinfo.creationDate = Chr$(0)
    PDFWriterProperties.docinfo.creator = Chr$(0)
    PDFWriterProperties.docinfo.producer = Chr$(0)
    PDFWriterProperties.docinfo.subject = Chr$(0)
    PDFWriterProperties.docinfo.keywords = Chr$(0)
    PDFWriterProperties.docinfo.modDate = Chr$(0)
     
    If ExtEscape(Printer.hdc, PDFFILENAME, Len(PDFWriterProperties), PDFWriterProperties, 0, 0) = PDFINPUT_OK Then
        ' Printer Escape Settings successful, now start the print job
        SetPDFFile = True
    Else
        'Printer Escape Settings failed
        SetPDFFile = False
    End If
End Function

Reply

Marsh Posté le 06-08-2003 à 11:46:29    

merci  :jap:

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed