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.

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

报告相同问题?

悬赏问题

  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥50 vue组件中无法正确接收并处理axios请求
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 MATLAB联合adams仿真卡死如何解决(代码模型无问题)
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决
  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题
  • ¥15 人在外地出差,速帮一点点
  • ¥15 如何使用canvas在图片上进行如下的标注,以下代码不起作用,如何修改