Impression fichier en vb6 : suppression boite de dialogue windows
dahouetagnes
Messages postés14Date d'inscriptionvendredi 3 février 2006StatutMembreDernière intervention 7 juin 2008
-
7 juin 2008 à 09:00
PCPT
Messages postés13272Date d'inscriptionlundi 13 décembre 2004StatutMembreDernière intervention 3 février 2018
-
7 juin 2008 à 20:13
Bonjour,
Comment faire en visual basic 6(lors de l'impression d'un fichier html en fichier pdf avec PDFcreator) pour que la boite de dialogue windows de l'impression ne s'ouvre pas , j'aimerais ne pas être obliger de cliquez sur " Imprimer" pour faire la conversion de mes fichiers.
Voiçi le code, ce code m'ouvre une fenêtre "windows impression" , je souhaite que l'impression se fasse tte seule sans avoir à appuyer sur la touche "imprimer" :
Private WithEvents PDFCreator1 As PDFCreator.clsPDFCreator
Private pErr As clsPDFCreatorError
Private opt As clsPDFCreatorOptions
Private Sub Class_Initialize()
Set PDFCreator1 = New clsPDFCreator
Set pErr = New clsPDFCreatorError
noStart = True
With PDFCreator1
.cVisible = True
If .cStart("/NoProcessingAtStartup") = False Then
If .cStart("/NoProcessingAtStartup", True) = False Then
Exit Sub
End If
.cVisible = True
End If
Set opt = .cOptions
.cClearCache
ImprimanteParDefaut = .cDefaultPrinter
noStart = False
End With
AddStatus "Program started"
End Sub
Public Sub ConversionPDF()
AddStatus "Start creating pdf : debut fct conversion pdf..."
With opt
.AutosaveDirectory = Trim$(NomDir)
.AutosaveFilename = Trim$(NomFichier)
.UseAutosave = 1
.UseAutosaveDirectory = 1
.AutosaveFormat = 0
.DontUseDocumentSettings = 0
End With
Set PDFCreator1.cOptions = opt
PDFCreator1.cClearCache
PDFCreator1.cDefaultPrinter = "PDFCreator"
PDFCreator1.cPrintFile Trim$(ChemDocComplet) 'c ici que ma fenetre s'ouvre
PDFCreator1.cVisible = False
PDFCreator1.cPrinterStop = False
StartTime = Now
While PDFCreator1.cPrinterStop = False
DoEvents
Wend
End Sub
Private Sub PDFCreator1_eReady()
AddStatus """" & PDFCreator1.cOutputFilename & """ was created! (" & _
DateDiff("s", StartTime, Now) & " seconds)"
PDFCreator1.cPrinterStop = True
End Sub
Private Sub PDFCreator1_eError()
Set pErr = PDFCreator1.cError
AddStatus "Error[" & pErr.Number & "]: " & pErr.Description
PDFCreator1.cDefaultPrinter = ImprimanteParDefaut
End Sub
Private Sub Class_Terminate()
If noStart = False Then
DoEvents
PDFCreator1.cClose
End If
Set PDFCreator1 = Nothing
Set pErr = Nothing
Set opt = Nothing
End Sub
A voir également:
Impression fichier en vb6 : suppression boite de dialogue windows