2013-05-10 234 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