Cfdocument – different behavior in CF7 vs CF8
Written on 26 October 2011, 02:26pm
The simple code below should write a PDF file on disk. This file should contain an image and two lines of text – next to the image (ignore the use of tables for layout 😛 ):
<cfsetting enablecfoutputonly="yes" showdebugoutput="no"> <cfoutput> <cfdocument filename="output#Left(server.ColdFusion.ProductVersion,1)#.pdf" format="pdf" overwrite="yes"> <cfdocumentsection marginleft="1"> <table> <tr> <td><img src='../images/image.gif'></td> <td>This is a simple text<br>spanning on two lines.</td> </tr> </table> </cfdocumentsection> </cfdocument> </cfoutput>
The result is quite different in ColdFusion 7 vs ColdFusion 8, as the following image shows:
In CF8, the PDF text and image appear visible smaller than in CF7.
Now the strange part: if I add
unit attribute to
cfdocument tag (with any value, ‘cm’ or ‘in’) – the CF8 version shows exactly the same size as CF7.
Anyone has any idea why this happens?
Written by Dorin Moise (Published articles: 220)