Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert an image to pdf using VBA

New Here ,
Nov 23, 2021 Nov 23, 2021

Hey there,

I am using the workaround with the button icon to import an image to a pdf file. And it worked well the last years... But now I got an file read error. I didn't change the code and also the images are the same. And also at the same location. I couldn't find anything on google. Maybe someone else has an idea?

 

Dim objAcroApp As Object, objAcroAVDoc As Object
    Dim objAcroPDDoc As Object, objJSO As Object
    Dim varKey As Variant
    Dim FDate As String
    
    Set objAcroApp = CreateObject("AcroExch.App")
    Set objAcroAVDoc = CreateObject("AcroExch.AVDoc")
    
    ' open file
    If objAcroAVDoc.Open(templateFile, "") = True Then
        
        Set objAcroPDDoc = objAcroAVDoc.GetPDDoc
        Set objJSO = objAcroPDDoc.GetJSObject
        
        ClearForm = objJSO.ResetForm()  'clear the form
        
        'add image
        objJSO.getField("##Skizze##").buttonImportIcon ("/C/test.jpg")
     End If

Screenshot (29).pngexpand image

TOPICS
PDF forms
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 03, 2022 Jan 03, 2022

I found a workaround! I too have a tool that uses the button image hack and it stopped working.

 

What I did was right before I try to load the image here:

> objJSO.getField("##Skizze##").buttonImportIcon ("/C/test.jpg")

 

I have it load something empty.  So it should look like this:

> objJSO.getField("##Skizze##").buttonImportIcon ("")

> objJSO.getField("##Skizze##").buttonImportIcon ("/C/test.jpg")

 

Please let me know if this works for you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 03, 2022 Jan 03, 2022

ooft, scratch that it's not working again.  For some reason the image doesnt load...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 05, 2022 Jan 05, 2022
LATEST

It's a pity, but it does not work for me 😞              

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines