Home
Home

---Soumis par Keri Hardwick---

Savegarder une impression d'état comme un fichier PDF.

    Si vous avex intallé Adobe Acrobat sur votre machine, vous pouvez générer une fichier PDF comme sortie d'état, permetant un visionnement et une distribution électronique à divers utilisateurs.

    Suivre les étapes suivantes pour mettre le tout ensemble.

Acheter et installer Acrobat sur la (les) machine(s) où les états seront créés.
Dans votre fichier Winini, ajouter une section comme la suivante, si elle n'existe pas déjà:

[Acrobat PDFWriter]
PDFFilename=C:\(path)\pdftemp.doc
bDocInfo=0

Si la section n'existe pas, la créer. Placer-la immédiatement après la section  [Ports]. La ligne filename fourni le chemin et pdffilename; la ligne bDocInfo engage une option de sorte que vous n'aurez pas de boîte de dialogue lorsque vous imprimez en  pdf.

Télécharger defaultprt.zip. Ce fichier continet le code pour changer d'imprimante, code publié par Ken Getz. Importer le module dans votre base de données.
Ajouter un nouveau module ainsi que ce code (ou l'insérer dans un module existant).

The legal stuff:
THE CODE CANNOT BE USED WITHOUT THE COPYRIGHT INFORMATION, AND YOU MAY NOT MODIFY THE EXISTING CODE.  ADD WHATEVER CODE YOU LIKE, IF YOU NEED, BUT LEAVE THE EXISTING CODE INTACT.

CE CODE NE PEUT PAS ÊTRE UTILISÉ SANS L'INFORMATION CONTENUE DANS LE COPYRIGHT, NI NE POUVEZ MODIFIER LE CODE ACTUEL. VOUS POUVEZ CEPENDANT AJOUTER LE CODE QUE VOUS DÉSIREZ,  À LA CONDITION DE LAISSER LE CODE EXISTANT INTACT.

Option Compare Database
Option Explicit
' Ces fonctions utilisent les procédures de
' Microsoft Access 95 How-To
'(c) 1998 Ken Getz and Paul Litwin
' All rights reserved.

' Les autres modules qu'on peut trouver à cette référence:
' basDefaultPrinter
' basGetPrinters
' basIniFile
' basPrintTypes
' basToken

' Vous devez également utiliser defaultprt.zip

Private drexisting As aht_tagDeviceRec
Const AcrobatName = "Acrobat PDFWriter"
Const AcrobatDriver = "PDFWRITR"
Const AcrobatPort = "LPT1:"
Sub ResetDefaultPrinter() 
	Call ahtSetDefaultPrinter(drexisting)
End Function
Function ChangeToAcrobat()
    If ahtGetDefaultPrinter(drexisting) Then
        Dim dr As aht_tagDeviceRec
        With dr
            .drDeviceName = AcrobatName
            .drDriverName = AcrobatDriver
            .drPort = AcrobatPort
        End With
        Call ahtSetDefaultPrinter(dr)
   End If
End Function

Sub ChangePdfFileName(NewFileName As String)
   Call aht_apiWriteProfileString("Acrobat PDFWriter", _
            "PDFFileName", NewFileName)
End Sub

 

Créer le fichier image de l'impression. Pour ce faire, placer, dans votre code, à l'endroit approprié (peut-être en réponse à un clic de bouton):
ChangeToAcrobat 
ChangePdfFileName "Nom du fichier image d impression .pdf" 
DoCmd.OpenReport "LeNomDeVotreÉtat", acViewNormal ResetDefaultPrinter