Hello Robin,
To print i use the function PrintFile from the code:
Function Generer_PDF(numOF)
' Auteur: Alexandre Iroulapane
' Date : 20/09/2019
' Description : Génère un PDF à partir d'un fichier html
Dim ShellObj, PDFCreatorQueue, scriptName, fullPath, printJob, objFSO, tmp, TargetFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set ShellObj = CreateObject("Shell.Application")
Set PDFCreatorQueue = CreateObject("PDFCreator.JobQueue")
Set PDFCreator = CreateObject("PDFcreator.PDFCreatorObj")
fullPath = "C:" & trim(NumOF)&".html"
'On Lance l'impression du fichier html
PDFCreator.PrintFile "C:" & trim(NumOF) & ".html"
'Initialisation de la file d'attente PDF Creator
On Error resume next
PDFCreatorQueue.Initialize
'On récupère le travail dans la file d'attente d'impression et on procède à la conversion + modification adaptation profil impression
If PDFCreatorQueue.WaitForJob (10) Then
Set printJob = PDFCreatorQueue.NextJob
printJob.SetProfileByGuid ("DefaultGuid")
'printJob.SetProfileSetting "Name", "AIE"
'printJob.SetProfileByGuid "AIE"
printJob.SetProfileSetting "OpenViewer", "False"
printJob.SetProfileSetting "OpenViewer", "False"
printJob.SetProfileSetting "OutputFormat", "Pdf"
printJob.SetProfileSetting "ShowQuickActions", "False"
printJob.SetProfileSetting "ShowProgress", "False"
'printJob.SetProfileSetting "SkipPrintDialog", "True"
printJob.SetProfileSetting "ShowAllNotifications", "False"
printJob.ConvertTo (fullPath)
'MsgBox "Releasing the object"
'On Error GoTo erreur
'PDFCreatorQueue.ReleaseCom
'End
End if
On Error Resume Next
PDFCreatorQueue.ReleaseCom
End Function
This code is used in a business application using vscript for custom actions.
I don't use the browser application for printing.
Thank by advance,
Regards,
Alexandre.