简单的pdf 跟白给一样 能告诉我简单的pdf代码吗?一个表格之类的简简单单就可以用php pdflib的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php$pdf = pdf_new();// 打开一个文件pdf_open_file($pdf, "pdftest.pdf");// 开始一个新页面(a4)pdf_begin_page($pdf, 595, 842);// 得到并使用字体对象$arial = pdf_findfont($pdf, "arial", "host", 1);pdf_setfont($pdf, $arial, 10);// 输出文字pdf_show_xy($pdf, "this is an exam of pdf documents, it is a good lib,",50, 750);pdf_show_xy($pdf, "if you like,please try yourself!", 50, 730);// 结束一页pdf_end_page($pdf);// 关闭并保存文件pdf_close($pdf);?>但打开会出现这个Fatal error: Uncaught exception 'PDFlibException' with message 'Font 'arial' with encoding 'host': Font file (AFM, PFM, TTF, OTF etc.) or host font not found' in C:\pleiades\xampp\htdocs\aaaa\xxx.php:17 Stack trace: #0 C:\pleiades\xampp\htdocs\aaaa\xxx.php(17): pdf_findfont() #1 {main} thrown in C:\pleiades\xampp\htdocs\aaaa\xxx.php on line 17这个是什么原因??? 给你个实例.你的错误是因为没有指定font的路径.<?php/* $Id: hello.php,v 1.6.2.1 2008/04/06 17:55:03 rp Exp $ * * PDFlib client: hello example in PHP */try { $p = new PDFlib(); # This means we must check return values of load_font() etc. $p->set_parameter("errorpolicy", "return"); /* This line is required to avoid problems on Japanese systems */ $p->set_parameter("hypertextencoding", "winansi"); /* open new PDF file; insert a file name to create the PDF on disk */ if ($p->begin_document("", "") == 0) { die("Error: " . $p->get_errmsg()); } $p->set_info("Creator", "hello.php"); $p->set_info("Author", "Rainer Schaaf"); $p->set_info("Title", "Hello world (PHP)!"); $p->begin_page_ext(595, 842, ""); $font = $p->load_font("Helvetica-Bold", "winansi", ""); if ($font == 0) { die("Error: " . $p->get_errmsg()); } $p->setfont($font, 24.0); $p->set_text_pos(50, 700); $p->show("Hello world!"); $p->continue_text("(says PHP)"); $p->end_page_ext(""); $p->end_document(""); $buf = $p->get_buffer(); $len = strlen($buf); header("Content-type: application/pdf"); header("Content-Length: $len"); header("Content-Disposition: inline; filename=hello.pdf"); print $buf;}catch (PDFlibException $e) { die("PDFlib exception occurred in hello sample:\n" . "[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " . $e->get_errmsg() . "\n");}catch (Exception $e) { die($e);}$p = 0;?> 谢谢那在那段字里画框怎么画啊?还有一个问题 为什么我的pdf 有pdflib.com 这个文字啊?网站上说把pdflib.reg改了就可以但是我找不到阿谢谢帮忙 我这也有,呵呵,不知道我们是不是相同的版本.我的是family版可能要付费的才去掉吧. 啊??我的也是family 晕阿那个就算了边框怎么画啊??我现在想做的是华表个然后写字谢谢先 PHP电台,实时传播,自己有电台,如何播放 drupal 类似工作流的,这个难点我该怎么做到? 如何上传超过2M的文件? 请教如何用JS获取并改变iframe的样式 奇怪的fopen问题,在线寻求答案,立刻结贴 apache如何把没有扩展名的文件解释成.php 请教PHP的环境配置 [急]ASP+IIS 与 PHP+Linux 如何做文件对传? 急! 怎样用php按照xml的属性来读 帮忙把一段php代码转换成asp代码 递归怎么用
$pdf = pdf_new();
// 打开一个文件
pdf_open_file($pdf, "pdftest.pdf");
// 开始一个新页面(a4)
pdf_begin_page($pdf, 595, 842);
// 得到并使用字体对象
$arial = pdf_findfont($pdf, "arial", "host", 1);
pdf_setfont($pdf, $arial, 10);
// 输出文字
pdf_show_xy($pdf, "this is an exam of pdf documents, it is a good lib,",50, 750);
pdf_show_xy($pdf, "if you like,please try yourself!", 50, 730);
// 结束一页
pdf_end_page($pdf);
// 关闭并保存文件
pdf_close($pdf);
?>
但打开会出现这个
Fatal error: Uncaught exception 'PDFlibException' with message 'Font 'arial' with encoding 'host': Font file (AFM, PFM, TTF, OTF etc.) or host font not found' in C:\pleiades\xampp\htdocs\aaaa\xxx.php:17 Stack trace: #0
C:\pleiades\xampp\htdocs\aaaa\xxx.php(17): pdf_findfont() #1 {main} thrown in C:\pleiades\xampp\htdocs\aaaa\xxx.php on line 17
这个是什么原因???
你的错误是因为没有指定font的路径.<?php
/* $Id: hello.php,v 1.6.2.1 2008/04/06 17:55:03 rp Exp $
*
* PDFlib client: hello example in PHP
*/try {
$p = new PDFlib(); # This means we must check return values of load_font() etc.
$p->set_parameter("errorpolicy", "return"); /* This line is required to avoid problems on Japanese systems */
$p->set_parameter("hypertextencoding", "winansi"); /* open new PDF file; insert a file name to create the PDF on disk */
if ($p->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
} $p->set_info("Creator", "hello.php");
$p->set_info("Author", "Rainer Schaaf");
$p->set_info("Title", "Hello world (PHP)!"); $p->begin_page_ext(595, 842, ""); $font = $p->load_font("Helvetica-Bold", "winansi", "");
if ($font == 0) {
die("Error: " . $p->get_errmsg());
} $p->setfont($font, 24.0);
$p->set_text_pos(50, 700);
$p->show("Hello world!");
$p->continue_text("(says PHP)");
$p->end_page_ext(""); $p->end_document(""); $buf = $p->get_buffer();
$len = strlen($buf); header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;}
catch (PDFlibException $e) {
die("PDFlib exception occurred in hello sample:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");
}
catch (Exception $e) {
die($e);
}$p = 0;
?>
那在那段字里画框怎么画啊?还有一个问题 为什么我的pdf 有pdflib.com 这个文字啊?
网站上说把pdflib.reg改了就可以
但是我找不到阿
谢谢帮忙
呵呵,
不知道我们是不是相同的版本.
我的是family版
可能要付费的才去掉吧.
我的也是family
晕阿
那个就算了
边框怎么画啊??
我现在想做的是华表个然后写字
谢谢先