Question

I'm creating PDFs on-demand with ColdFusion's CFDocument tag, like so:

<cfdocument format="PDF" filename="#attributes.fileName#" overwrite="true">
    <cfdocumentitem type="footer">
        <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr>
                <td align="left"><font face="Tahoma" color="black"><strong>My Client's Corporation</strong><br/>Street address<br/>City, ST 55555</font></td>
                <td align="right"><font face="Tahoma" color="black">Phone: 555.555.5555<br/>Fax: 555.555.5555<br/>Email: info@domain.com</font></td>
            </tr>
        </table>
    </cfdocumentitem>
    <html>
        <body>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <!--- some content here ... --->
            </table>
        </body>
    </html>
</cfdocument>

The problem I'm having is that sometimes (actually, most of the time, but not always) some of the footer text is there, but invisible. I can highlight it and copy/paste it into notepad, where I can see it all -- but in the generated PDF only the first line of the left column of the footer is visible, the rest is invisible. Hence why I added the font color of black in the code.

screenshot of problem

Any ideas on how to correct this?

Was it helpful?

Solution

A PDF is what I'm after, so I'm not sure how outputting another format would help.

As it turns out, the footer space just wasn't enough to fit all of this text; verified by the fact that changing the font size to 4pt would fit it all in without a problem.

I spent some time attempting to rewrite the footer code using DDX as outlined here and the CFPDF tag to implement it; but even after several hours of hacking away and finally getting a valid DDX as reported by the new isDDX function, the CFPDF tag reported that it was invalid DDX for some reason.

At this point I decided I had wasted enough of the client's time/money and just reformatted the footer to be 2 lines of centered text, which was good enough.

OTHER TIPS

Usually when PDF shows blank text, it's because the font metrics are embedded in the document, but the glyphs are not. I know nothing about ColdFusion, but you might try the following:

  • Try a font other than Tahoma as a test. All PDF readers must support 14 basic fonts, including 4 Helvetica variants, 4 Times variants, 4 Courier variants, Symbol and ZapfDingbats, so those are always safe choices
  • See if ColdFusion offers any control over font embedding
  • Try a list of alternatives in your font declaration, like "Tahoma,Helvetica,sans-serif"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top