@fmerlet wrote:
Hello,
Now i have the last version of PDF Creator and my Lotusscript agent doesn't working.
It was working fine with the version 1.7 of PDF Creator.here the code :
Set PDFCreator = CreateObject("PDFCreator.clsPDFCreator")
If PDFCreator Is Nothing Then
MsgBox "Vérifier que PDFCreator est bien installé sur votre pc",,"PDFCreator n'est pas détecté"
End IfIf Not PDFCreator.cStart("",True) GoTo processError
PDFCreator.cPrinterStop = True
PDFCreator.cClearCache
If mode = "liste_select" Then 'on a plusieurs docs sélectionnés
Set doc = collection.GetFirstDocument
Set uidoc = workspace.EditDocument(True, doc) 'on ouvre le premier en mode Edition
ElseIf mode = "liste" Then 'le mail n'est pas ouvert
Set uidoc = workspace.EditDocument(True) 'on l'ouvre en mode Edition
Else 'le mail est ouvert
Set doc = workspace.CurrentDocument.Document
Set uidoc = workspace.EditDocument(True, doc) 'on le ré-ouvre en mode Edition
End If
debut:
emetteur = uidoc.FieldGetText("From")
intitule = uidoc.FieldGetText("Subject")
'20 premiers caractères de l'émetteur - + les premiers caractères de l'intitulé pour faire max 100'impression PDF
Dim PrinterPath As String
PrinterPath = "PDFCreator"
On Error GoTo impressionImpossible
Call uidoc.Print(1, 0, 0, False, PrinterPath)
On Error Resume Next
suite:
'fermeture du mail en mode Edition
Call uidoc.Close
If mode = "liste_select" Then 'si on a plusieurs docs
Set doc = collection.GetNextDocument (doc)
If Not doc Is Nothing Then 's'il en reste
Set uidoc = workspace.EditDocument(True, doc) 'on ouvre le suivant en mode Edition
GoTo debut
End If
End If
If nbdoc >0 Then
Do Until PDFCreator.cCountOfPrintjobs = nbdoc
Loop
With PDFCreator
.Ccombineall
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.coption("AutosaveDirectory")=spdfpath
.cOption("AutosaveFilename") = nomfichier & ".pdf"
.cOption("AutosaveFormat") = 0
End With
PDFCreator.cPrinterStop = False
While PDFCreator.cCountOfPrintjobs > 0
Sleep 1
Wend
End If
PDFCreator.cClose
testVide = False
Do Until testVide = True
Call deplace(testVide,spdfpath)
Loop
objFSO.DeleteFolder(spdfpath & temppath)
Exit Sub
impressionImpossible:
nbdoc = nbdoc-1
GoTo suite
fin:
Exit Sub
processError:
MsgBox "Vérifier que PDFCreator est bien installé sur votre pc",,"Fonctionnalité PDF n'est pas opérationnelle"
Print "Error: "+Error()+" Line: "+Cstr(Erl)
Resume finEnd Sub
Sub doublon(objFSO, debutNom, extension)
If Right(debutNom, 1) <> "." Then
Call doublon(objFSO, Left(debutNom, Len(debutNom)-1), Right(debutNom, 1) & extension)
ElseIf Left(Right(debutNom, 4),1) = "(" And IsNumeric(Left(Right(debutNom, 3),1)) And _
Left(Right(debutNom, 2),1) = ")" Then
objFSO.MoveFile debutNom & extension, Left(debutNom, Len(debutNom) - 4) & "(" & _
Left(Right(debutNom, 3),1) +1 & ")." & extension
ElseIf Left(Right(debutNom, 5),1) = "(" And IsNumeric(Left(Right(debutNom, 4),2)) And _
Left(Right(debutNom, 2),1) = ")" Then
objFSO.MoveFile debutNom & extension, Left(debutNom, Len(debutNom) - 5) & "(" & _
Left(Right(debutNom, 4),2) +1 & ")." & extension
Else
objFSO.MoveFile debutNom & extension, Left(debutNom, Len(debutNom)-1) & " (1)." & extension
End If
End SubWhat is the difference for it's working with the new version ?
Posts: 2
Participants: 2