@GUIBOUT wrote:
Bonjour,
J’ai programmé en VB sous EXCEL une impression de document vers PDF en utilisant l’imprimante PDF de OFFICE. Celle-ci sort des fichiers de 550 ko alors que si je le fais manuellement avec PDFCREATOR, j’obtiens un fichier de 50 ko environ.
Je suis à la recherche de comment référencer en COMPLEMENT d’Office l’imprimante PDFCREATOR.
J’ai trouvé du code fonctionnant avec les versions 1.7 de PDFCREATOR.
Après recherches, j’ai trouvé les codes pour faire le VB
Il faut aller dans C:\Program Files\PDFCreator\COM Scripts\Word - VBA,
Il faut ensuite ouvrir le fichier docm et autoriser les macros puis ouvrir le code Visual Basic via l’onglet Developpeur.
Avec mon ancien code et les exemples vus, je pense pouvoir faire le mix pour imprimer.Je mets ci-dessous une 1ere partie de ce code
’ PDFCreator COM Interface test for VBA
’ Part of the PDFCreator application
’ License: GPL
’ Homepage:
’ Version: 1.0.0.0
’ Created: June, 16. 2015
’ Modified: June, 16. 2015
’ Author: Sazan Hoti
’ Comments: This project demonstrates the use of the COM Interface of PDFCreator.
’ There are 5 different kinds of usage presented.
’ Note: More usage examples then in the VBA directory can be found in the JavaScript directory only.
’ IMPORTANT: Set a reference to the pdfcreator.tlb!Sub testPage2PDF()
Dim fullPath
Dim PDFCreatorQueue As Variant
Dim printJob As VariantSet PDFCreatorQueue = CreateObject(“PDFCreator.JobQueue”)
fullPath = ActiveDocument.Path & "\TestPage_2Pdf.pdf "MsgBox "Initializing PDFCreator queue…"
PDFCreatorQueue.Initialize'Set printer if necessary
Application.ActivePrinter = “PDFCreator”MsgBox "Printing the current active document…"
ActiveDocument.PrintOut Background:=FalseMsgBox "Waiting for the job to arrive at the queue…"
If Not PDFCreatorQueue.WaitForJob(10) Then
MsgBox "The print job did not reach the queue within " & " 10 seconds"
Else
MsgBox "Currently there are " & PDFCreatorQueue.Count & " job(s) in the queue"
MsgBox "Getting job instance"
Set printJob = PDFCreatorQueue.NextJobprintJob.SetProfileByGuid ("DefaultGuid") MsgBox "Converting under ""DefaultGuid"" conversion profile" printJob.ConvertTo (fullPath) If (Not printJob.IsFinished Or Not printJob.IsSuccessful) Then MsgBox "Could not convert the file: " & fullPath Else MsgBox "Job finished successfully" End If
End If
MsgBox "Releasing the object"
PDFCreatorQueue.ReleaseCom
End SubIl me manque un élément : Comment faire
’ IMPORTANT: Set a reference to the pdfcreator.tlb!Merci de votre aide
Cordialement
Posts: 1
Participants: 1