我在使用FPDF库(ASP端口版本)生成pdf时插入图像有一些问题,你可以在这里获取ASP FPDF
我试过这段代码(这是ASP VBScript):
pdf.Image Server.MapPath("map.jpg"), 10, 10, 800, 400
pdf.Image "map.jpg", 10, 10, 800, 400
pdf.Image "http://localhost/pdf_test/map.jpg", 10, 10, 800, 400
以上代码都没有工作......它会一直抛出错误:
Microsoft JScript runtime error '800a138f'
Object expected
/pdf/libs/fpdf.asp, line 817
从 fpdf.asp第817行(这是ASP JScript):
type=SupposeImageType(xfile);
但是,如果没有插入图像a.k.a纯文本pdf,它可以正常工作。有人可以帮我解决这个问题吗?
感谢
德尔斯
答案 0 :(得分:1)
在fpdf/include/images.asp
中对您的字符集进行以下更改:
this.Buffer.CharSet ="ISO-8859-1"
答案 1 :(得分:0)
这是我用来在标题中显示图像的代码。我有的问题是我想为图像使用变量,当我把变量名称而不是图像名称时,我得到一个错误:
Microsoft JScript运行时错误“800a138f”
'undefined'为null或不是对象
/EKtestdb/fpdf/fpdf/includes/Basics.asp,第121行
this.Header=function Header()
{
this.SetY (10)
this.SetFont ("Times","",10)
//this.Cell (45,5, "HEADER", 0, 0, "L")
this.SetFont ("Times","b",14)
//this.Cell (190,5, this.title, 0, 0, "C")
this.Cell (190,20, this.title, 0, 0)
this.SetFont ("Times","",10)
this.Image('logoSM1.jpg',165,3,33)
this.Image( techpic ,165,3,33)
这是basics.asp第121行的代码:
this.strrpos=function strrpos(s,ch){
res = s.lastIndexOf(ch)
if (res>0-1){return res}else{return false}
}
this.strpos=function strpos(s,ch,start){
if (arguments.length<3){start=0}
res = s.indexOf(ch,start);
if (res>-1){return res}else{return false}
}
如果您只想显示图像,此行应该有效:
this.Image('logoSM1.jpg',165,3,33)
但是对于使用变量而不是图像名称,有人可以帮忙吗?