Skip to main content
October 20, 2011
Question

CFDOCUMENT PDF HEADER FONT SIZE

  • October 20, 2011
  • 2 replies
  • 3023 views

Using CF to create a PDF via <cfdocument> and finding that the font sizes within the header do not scale properly.  I've researched the web for hacks or solutions and cannot find any.  Has anyone been able to make the headers in CFDOCUMENT work?  I've adj the topmargin size and the font will adj once you get to 3 inches or greater but then there is huge white space at the top of the document.

if anyone has any suggestions, would appreciate the feedback.

    This topic has been closed for replies.

    2 replies

    Participant
    September 27, 2013

    Whatever styling you have, it looks like it needs to be placed into the particular section being rendered.  So there would need to be CSS for the cfdocument and CSS for each cfdocumentitem.

    for example:

    <cfdocument format="pdf" margintop="1">

         <cfdocumentitem type="header">

              <style>

                   .dept_title  {  font-size:32px;  font-weight:bold;   }

              </style>

              <div class="dept_title">Department Title</div>

             </cfdocumentitem>

      ..rest of document 

    </cfdocument>

    Also, the margin-top needs to be able to accommodate the size of the content as well. 

    All the best,

    Terry

    Inspiring
    October 21, 2011

    Hi There,

    I had the same issue with fonts in the header. The work around I came up for me (at least) was the following.

    1. <cfdocument ... margintop="0" ...>
    2. I create a separate .cfm file, with a <div> tag setting the height to the desired header height. I then place the header content inside the <div> tag like images, barcodes, titles, etc, with desired font and border formatting applied.
    3. I insert the header content with a <cfinclude> tag, as the first line in the <cfdocument> tag. The rest of the page content is inserted below the <cfinclude>. If more then one page, I just <cfinclude> the header content again on the second page and so on. If changes are required, I change the header page which then updates appropriately where inserted.

    Additionally this allows me to insert odd and even headers into multiple page documents, while controlling the font structure, etc. It also allows me to insert a different header for the first page, with a subsequent header for the rest of the pages.

    Others may have their own solution to the header font formatting issue. However, like I said this is what I have found works for me.

    Leonard B