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">
<cfpdfsubform name="topmostsubform">
<cfpdfformparam name="CompanyName" value="#Trim(assocName)#"> <!--- this displays OK --->
<cfpdfformparam name="logo" value="logofilename.jpg" > <!--- image does not display --->
</cfpdfsubform>
</cfpdfform>
Thank you, in advance, for your help!
Views
Replies
Total Likes
Hi,
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"
For example:
ImageField1.rawValue = form1.page1.image1.value.image.value
Hope that helps,
N.
Views
Replies
Total Likes
Thanks for the reply! So does the value property you mention have the name of the image file or the actual image e.g., Base64 image data, in it?
Views
Replies
Total Likes
Hi,
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.
Good luck,
Niall
Views
Replies
Total Likes
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
Views
Replies
Total Likes
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">
<cfpdfsubform name="form1">
<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#">
</cfpdfsubform>
</cfpdfform>
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies