Stamp on PDF / CreateObject / pdfforge / PDFCreator Pro

Hi everyone,

We have been using Excel (VBA) to create and add stamps on PDF (PDFCreator version 1.7.3) since many years.
The Excel function was : Set pdf = CreateObject("pdfforge.pdf.pdf"), and it worked perfectly.
We had to download the new version of PDFCreator Pro, and since then, the function doesn't work anymore. Is it replaced by another function? If so, which one? How to change the code?

Here a part of our actual code:

Sub STAMP()
Dim pdf As Object, pdfText As Object, pdfText1 As Object, pdfText2 As Object, pdfLine As Object, pdfLine2 As Object, pdfLine3 As Object, pdfLine4 As Object
Dim sNomDoc As String
Dim Num As Long
Dim REF As String
Dim nlot As String

Set pdf = CreateObject("pdfforge.pdf.pdf")
Set pdfText = CreateObject("pdfforge.pdf.pdfText")
Set pdfText1 = CreateObject("pdfforge.pdf.pdfText")
Set pdfText2 = CreateObject("pdfforge.pdf.pdfText")
Set pdfLine = CreateObject("pdfforge.pdf.pdfline")
Set pdfLine2 = CreateObject("pdfforge.pdf.pdfline")
Set pdfLine3 = CreateObject("pdfforge.pdf.pdfline")
Set pdfLine4 = CreateObject("pdfforge.pdf.pdfline")

REF = ThisWorkbook.Sheets("FEUIL2").Range("B2")
nlot = ThisWorkbook.Sheets("FEUIL2").Range("B4").Value

sNomDoc = ThisWorkbook.Path & ThisWorkbook.Sheets("FEUIL2").Range("B7") & "" & REF & "_" & ThisWorkbook.Sheets("FEUIL2").Range("B3").Value & ".pdf"
If Dir(sNomDoc) <> "" Then
Num = pdf.NumberOfPages(sNomDoc)
Else
MsgBox "FICHIER INTROUVABLE"
End If

With pdfText
    .fillOpacity = 1

    .FontColorBlue = 255
    .FontColorGreen = 0
    .FontColorRed = 0

    .FontName = "ariblk.TTF"
    .FontSize = 10
    .Rotation = 0
    .Text = "VALABLE POUR"
    .XPosition = 254
    .YPosition = 193

    pdf.AddTextToPDFFile sNomDoc, ThisWorkbook.Path & "\" & "AddText.pdf", 1, Num, pdfText
End With

[...]
End Sub

Thanks for your help,
Best regards
Sarah

Hi Sarah,

sorry for the trouble.
The entire PDFCreator application was rewritten after version 1.7.3 and the COM-interface was, too.
You can find the current documentation as well as a migration guide here:
https://docs.pdfforge.org/pdfcreator/4.0/en/pdfcreator/com-interface/

Best regards

Robin

Thanks Robin for the documentation, but it's not very helping.. Do you have an example of how using the new COM-interface ?
Thanks

Hi Sarah,

you can find a VBA example for the current COM interface inside the COM Scripts folder of the PDFCreator installation directory.

Best regards

Robin