New Participant
February 13, 2025
Question
No image on pdf document
- February 13, 2025
- 3 replies
- 770 views
I have a ColdFusion script that creates a PDF to be sent for archiving. The PDF is created with the following function:
<cfdocument format="pdf" orientation="portrait" pagetype="A4" unit="cm" marginbottom="2" margintop="2" filename ="#path#" overwrite="true">
The problem is that sometimes the generated file is missing images and instead shows a square with a red 'x' inside. The issue is that the image exists because it is static and present in the filesystem:
The problem is that sometimes the generated file is missing images and instead shows a square with a red 'x' inside. The issue is that the image exists because it is static and present in the filesystem:
<img src="../../portale_admin/img/image.png" align="#positioning#"></img>
And 99% of the time, it is correctly included. In addition i have a function:
And 99% of the time, it is correctly included. In addition i have a function:
<cffunction name="checkImage" returntype="void">
<cfargument name="img_path">
<cfset img_path = ExpandPath("#img_path#")>
<cftry>
<cfimage action="read" source="#img_path#" name="testImage">
<cfcatch>
<cflocation url="/missioni/portale_admin/no_img_pdf.cfm">
</cfcatch>
</cftry>
</cffunction>
<p style="font-size:9px;">
<cfset checkImg = checkImage("../../portale_admin/img/image.png")>
<img src="../../portale_admin/img/image.png" align="#positioning#"></img>
</p>
