免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2050 | 回复: 4
打印 上一主题 下一主题

php使用PDF出现这样的错误是什么原因啊 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-31 15:29 |只看该作者 |倒序浏览
Fatal error: Uncaught exception 'PDFlibException' with message 'Metrics data for font 'Arial' not found' in D:\wamp\www\forextjs\test.php:7 Stack trace: #0 D:\wamp\www\forextjs\test.php(7): pdf_findfont(Resource id #2, 'Arial', 'host', 1) #1 {main} thrown



下面是源程序
  1. <?php
  2. phpinfo();
  3. $pdf   =   PDF_new();
  4. PDF_open_file($pdf,   "LineExam.pdf ");
  5. PDF_begin_page($pdf,   595,   842);
  6. //设定Arial字体
  7. $arial   =   PDF_findfont($pdf,   "Arial",   "host",   1);
  8. PDF_setfont($pdf,   $arial,   12);

  9. //   设定直线的颜色
  10. PDF_setcolor($pdf,   "stroke ",   "rgb ",   0,   0,   0);

  11. //画出直线
  12. PDF_moveto($pdf,   20,   780);
  13. PDF_lineto($pdf,   575,   780);
  14. PDF_stroke($pdf);

  15. //   在页面底部画出另外一条直线
  16. PDF_moveto($pdf,   20,50);
  17. PDF_lineto($pdf,   575,   50);
  18. PDF_stroke($pdf);

  19. //   输出一些文字
  20. PDF_show_xy($pdf,   "Meng 's   Corporation ",   200,   35);
  21. //结束PDF内容的绘制和制作
  22. PDF_end_page($pdf);
  23. //关闭PDF文档
  24. PDF_close($pdf);
  25. ?>
复制代码

论坛徽章:
0
2 [报告]
发表于 2011-03-31 16:11 |只看该作者
字体找不到

论坛徽章:
0
3 [报告]
发表于 2011-03-31 16:31 |只看该作者
回复 2# ws00377531


    这是在windows下的,字体不是默认在windows/font下吗

论坛徽章:
0
4 [报告]
发表于 2011-03-31 17:17 |只看该作者
回复 3# bowenpro


    Search for a font and prepare it for later use with PDF_setfont().

论坛徽章:
0
5 [报告]
发表于 2011-04-01 10:11 |只看该作者
这个不好用,找到好用的了,FPDF,确实不错
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP