Could you please give me your code example of that specific process:
-convert BMP logo files into PDF (you say that's a necessary step)
-insert that image logo into a PDF file at (x,y).
Thank's a lot.
Even if the code seems to be good, I could not see the image...
Thank you for any precious help.
' AddImageInsidePDF.vbp
'
' - The application shows how to insert an image inside PDF document
'
' - To run the sample:
'
' 1. Copy the FormsAutomation.pdf and MyImage.pdf files into the
' C:\ directory.
' 2. Run the sample and click on the Create Fields button. The
' sample will open the PDF in Acrobat and add form fields
' (image) to it.
Dim formApp As AFORMAUTLib.AFormApp
Dim acroForm As AFORMAUTLib.Fields
Dim field As AFORMAUTLib.field
Dim bOK As Boolean
Dim avDoc As CAcroAVDoc
Dim pdDoc As CAcroPDDoc
Private Sub CreateFieldsButton_Click()
'Set the mouse icon to display an hourglass
Screen.MousePointer = 11
'Disable the create fields button
CreateFieldsButton.Enabled = False
'Update the status box
StatusBox.Text = "Opening PDF Document..."
' Open the sample PDF file
Set avDoc = CreateObject("AcroExch.AVDoc")
'bOK = avDoc.Open("C:\FormsAutomation.pdf", "Forms Automation Demo")
'If everything was OK opening the PDF, we now instantiate the Forms
'Automation object.
If (bOK) Then
Set formApp = CreateObject("AFormAut.App")
Set acroForm = formApp.Fields
Else
Set avDoc = Nothing
MsgBox "Failed to open PDF Document. Aborting..."
End
End If
'Update the status box
StatusBox.Text = "Creating Form Fields..."
'Create a button that represents an image
Set field = acroForm.Add("Logo Button", "button", 0, 175, 50, 225, 100)
field.BorderStyle = "beveled"
'field.Highlight = "push"
field.IsReadOnly = True
field.SetButtonIcon "N", "c:\MyImage.pdf", 0
'Update the Status box.
StatusBox.Text = "Fields have been added successfully."
'****************
'This section converts a AVDoc to a PDDoc. Then we use PDDoc.Save to
'save the PDF since there isn't a viewer level method to save an AVDoc.
'These lines are commented out to provide user feedback
'If present, no doc is visible and original form is changed
'so it isn't obvious what the sample did, and it doesn't work
'twice in a row.
'It's best to have Acrobat open and visible to see form creation
'''''''''
Set pdDoc = avDoc.GetPDDoc
'bOK = pdDoc.Save(1, "C:\FormsAutomation_result.pdf")
If bOK = False Then
MsgBox "Unable to Save the PDF file"
End If
' Close the AVDoc
avDoc.Close (False)
'''''''''
'End provide User Feedback
'****************
CleanUp:
'Change the mouse pointer to display normal cursor and enable the Exit button
Screen.MousePointer = 0
'Enable the create fields button
CreateFieldsButton.Enabled = True
End Sub
Private Sub ExitButton_Click()
' End the program
End
End Sub
Did you ever get a solution to your problem of not being able to see the image on button? I am having the same probelm and would like to know if you were able to solve it.
TIA
I have not resolved this little problem yet. But, be sure that the solution is near following my point of view.
If you find something, please let me know.
Regards,