duanluangua8850 2012-12-17 09:17
浏览 42
已采纳

TCPDF字体开关

I've been looking around the TCPDF docs (http://www.tcpdf.org/doc/code/classTCPDF.html) and can't find the solution to this issue anywhere.

How do I output a string on the PDF with mixed fonts? ie. let's say I want to output "hello world" but to have "hello" outputed using one font and "world" outputed other font.

I know how to do it in 2 different tries, ie. pick one font, echo 1 word, pick other font, echo other word. But is there a way to somehow do it all at once?

My issue is with echoing out centered HTML spans. I have 2 spans outputed using writeHTMLCell function where one span should be outputed using one font and the second one using the other font.

Can I maybe do this using TCPDF CSS?

Basically, I'm looking for a way to have centered text within a box with invisible borders, and 1 word of the text is outputed using 1 font / color, and the other word using other font / color.

Thanks!

EDIT: btw: I'm using custom font imported via addTTFfont function.

  • 写回答

1条回答 默认 最新

  • douyu0845 2012-12-17 11:13
    关注

    This anwser found on stackoverflow.com solved my issue => TCPDF Codeigniter use multiple fonts

    Truns out custom fonts can be defined through CSS.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 STM32cubeMX里的FreeRTOS无法释放内存
  • ¥15 CATIA有些零件打开直接单机确定终止
  • ¥15 请问有会的吗,用MATLAB做
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 ARIMA模型时间序列预测用pathon解决
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站