I am trying to place a company logo with Coldfusion 8 on a PDF form. Text fields work fine as CF variables but the image does not appear.
Apparently I need something other than value="logofilename.jpg" but I can't find any doc on what to use.
Here is my code - very simple:
<cfpdfform source="#sourcePDFpath#" action="populate">
<cfpdfformparam name="CompanyName" value="#Trim(assocName)#"> <!--- this displays OK --->
<cfpdfformparam name="logo" value="logofilename.jpg" > <!--- image does not display --->
Thank you, in advance, for your help!
I have not worked with Cold Fusion; however when dynamically changing the image within an image field we use the following FormCalc property "value.image.value"
ImageField1.rawValue = form1.page1.image1.value.image.value
Hope that helps,
The image.value is the actual image.
The "image1" is a static image in the PDF form. For example you might have different images, each placed in the form as invisible static image fields.
The dynamic image field ("ImageField1") starts off as blank. Depending on the users actions, the script assigns the appropriate invisible image to the image field.
My example was based on images that are already inside the PDF form (a sample is uploaded).
In your case you may be assigning the image from outside of the PDF. I do not have a solution for achieving this. While the script I showed handles images that are in the PDF, it may give you a direction when lookign at Cold Fusion.
I know in the past, I have set the rawValue of an image field to a serialized BLOB of an image. Is there anything along those lines you can work with?
I would generally stay away from Image.value. ".value" never seems to work right for me, and it is very depenent on what type of object you are talking about.
Hope this helps!
Ryan D. Lunka
Cardinal Solutions Group
ToBase64 is the function you require to use an image in a cfpdfformparam field.
<cfimage action="read" source="myImage.jpg" name="myImage">
<cfset myImage = ToBase64(myImage)>
<cfpdfform source="myPDF.pdf" action="populate">
<cfpdfformparam name="HeaderField" value="#HeaderText#" />
<cfpdfformparam name="IntroField" value="#IntroField#" />
<cfpdfformparam name="BodyField1" value="#BodyField1#" />
<cfpdfformparam name="BodyField2" value="#BodyField2#" />
<cfpdfformparam name="ImageField1" value="#myImage#">