2013-05-10 336 views
3

我正在使用<cfdocumentitem type="footer">在PDF文档中创建页脚,它工作正常。除了我似乎无法控制字体。我试过<span><font face>等没有运气。目前我正在尝试与类如下表。CFDocumentItem - 更改字体大小

任何人都知道如何控制<cfdocumentitem>在页脚中的字体外观?

<cfdocument format="pdf" 
     marginBottom = ".5" 
     marginLeft = ".4" 
     marginRight = ".4" 
     marginTop = ".2" 
     > 

<style type="text/css">@import "pdf.css";</style> 

<cfdocumentitem type="footer"> 
    <cfoutput> 
    <table width=100%> 
     <tr> 
      <td class=verd10> 
       <b>#pdfstuff.pdffinal#</b> 
      </td> 
      <td align=right class=verd10 valign=top> 
       Page #cfdocument.currentPageNumber# of #cfdocument.currentPageNumber# 
      </td> 
     </tr> 
    </table> 
    </cfoutput> 
</cfdocumentitem> 

pdf document data etc 

</cfdocument> 

回答

1

尝试添加样式表链接的副本内页脚,就像这样:

<cfdocumentitem type="footer"> 
    <style type="text/css">@import "pdf.css";</style> 
    <cfoutput> 
     <table> 
      ... etc 
     </table> 
    </cfoutput> 
</cfdocumentitem> 
+0

在@import中拉动效果会更好一点...获取我想要的字体面,但不是大小...奇怪的东西 - 我可以在普通PDF中使用.pdf12 - 12pt字体,但在页脚中使用相同的字体是更小 - 更像是一个10分,但我称为PDF12 - 似乎只是限制我的尺寸,我可以在那里使用...不知道,如果marginbottom也有什么关系呢? – 2013-05-12 16:18:15

+0

是的 - 将我的marginbottom增加到1.5而不是.5显着地改变了我的字体大小......它必须限制您在为marginbottom分配的空间内的大小。 @import如上所述是必需的。 – 2013-05-12 16:24:03

1

欢迎使用cfdocument。我能够在页脚中成功格式化任何文本的唯一方法是使用html和内联样式的组合。

这里是为我工作的页脚:

<cfdocumentItem type="footer"> 
    <table width="100%"> 
     <tr> 
      <td style="font-family:Arial; font-size: 9pt;">Printed On: #dateFormat(now(), "mm/dd/yyyy")# #timeFormat(now(), "HH:MM")#</td> 
      <td style="font-family:Arial; font-size: 9pt;" align="right">Page #cfdocument.currentPageNumber# of #cfdocument.totalPageCount#</td> 
     </tr> 
    </table> 
</cfdocumentItem> 
+0

我不知道这是工作......总是以相同的大小结束 - 即使我使用我们的代码去10pt,11pt等......我想知道它是否被限制在一定的大小? – 2013-05-10 17:17:30

+0

嗯,我知道我的工作,因为在我应用风格的文字是巨大的。你有没有尝试过更明显的颜色? – Travis 2013-05-10 17:37:59