GeneratePDF extension obsoleted

Hi @dvkc91

As this activity only support the legecy project. You can replicate the same by using invoke code/ Invoke VBA activity, You need to write a code in VBA something like this by calling this code & providing the image & pdf path it can be done.

Sub AddImageToPDF()
    Dim pdfReader As Object
    Dim pdfStamper As Object
    Dim pdfContentByte As Object
    Dim img As Object
    Dim imgPath As String
    Dim pdfPath As String
    Dim outputPath As String

    ' Paths to the input PDF, image, and output PDF
    pdfPath = "C:\path\to\input.pdf"
    imgPath = "C:\path\to\image.jpg"
    outputPath = "C:\path\to\output.pdf"

    ' Create iTextSharp objects
    Set pdfReader = CreateObject("iTextSharp.text.pdf.PdfReader")
    Set pdfStamper = CreateObject("iTextSharp.text.pdf.PdfStamper")
    Set img = CreateObject("iTextSharp.text.Image")

    ' Open the PDF
    pdfReader.Open pdfPath
    pdfStamper.Create pdfReader, outputPath

    ' Get the content byte layer
    Set pdfContentByte = pdfStamper.GetOverContent(1)

    ' Load the image
    Set img = img.GetInstance(imgPath)

    ' Set the image position and size
    img.SetAbsolutePosition 100, 500
    img.ScaleToFit 200, 200

    ' Add the image to the PDF
    pdfContentByte.AddImage img

    ' Close the stamper and reader
    pdfStamper.Close
    pdfReader.Close

    MsgBox "Image added to PDF successfully!"
End Sub

This code is AI Generated but you can improve on this.

Hope this helps :slight_smile: