Log in

No account? Create an account
..::.:.:. ..: .........: .:::..:::.
January 2010
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

boxing_cat [userpic]
cfdocument tag issues

If you use <cfdocument> tag to convert a part of your html code into a pdf file, you may encounter many annoying problems.  But still you can avoid them if you know some tricks.  

Scaling is the most irritating problem.  Do not use styles in the html document you want to convert into pdf.  For example this part of code will give you the right size of font in the pdf document.


<cfdocument  format = "PDF" filename = "invoices_personal.pdf" overwrite="yes">


<strong><font size="+3">#ttl# No. TR00#getTraining.id#-#n#</font></strong>




But this will give you not what you want since this tag does not support CSS and your text will be scaled to the default size.


<cfdocument  format = "PDF" filename = "invoices_personal.pdf" overwrite="yes">


<strong><span class=”smalltext”>#ttl# No. TR00#getTraining.id#-#n#</span></strong>




Another problem – this tag screws up images.  I found out that it’s a good practice to use <cfdocumentitem type="header"> for documents that have logo images.  In this case this tag does not distort images as it does when the image is placed into the document body.  Be shure to specify precise size of the image and the dimensions of the image container. In this example it’s a table cell


<cfdocumentitem type="header">

<table width="800" border="0" cellspacing="0" cellpadding="3">


    <td width="100"><img src="../images/logos/umassredlogo100.gif" width="100" height="100"></td>

    <td width="400" valign="top"><strong>University of Massachusetts  Amherst<br>

      Massachusetts Energy Efficiency Partnership</strong><br>     

      Engineering Laboratory   Building <br>

      160 Governors Drive<br>

    Amherst, MA 01003-9265<br>    </td>

    <td width="100" valign="top">http://www.maeep.org<br>

      Email: info@maeep.org <br>

      Tel: (413)-545-2853<br>

    Fax:  (413-545-2853</td>





As conclusion I can say that this tag is a kind of the disappointing for developers. However, you can get from it some results if you know how to cheat on it.