【问题标题】:ASP FPDF, problem with inserting imageASP FPDF,插入图像的问题
【发布时间】:2009-03-27 09:41:06
【问题描述】:

当我使用 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);


但是,如果不插入图像(s)a.k.a text-only pdf,它可以正常工作。有人可以帮我解决这个问题吗?

谢谢
德尔斯

【问题讨论】:

    标签: asp-classic vbscript javascript fpdf


    【解决方案1】:

    fpdf/include/images.asp 中对您的字符集进行以下更改:

    this.Buffer.CharSet ="ISO-8859-1"
    

    【讨论】:

      【解决方案2】:

      这是我用来在标题中显示图像的代码。我遇到的问题是我想为图像使用一个变量,当我输入变量名称而不是图像名称时,我得到一个错误:

      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)
      

      但是对于使用变量而不是图像名称,有人可以帮忙吗?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-12-21
        • 1970-01-01
        • 2012-03-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多