dougou6727 2013-11-05 08:56
浏览 91
已采纳

FPDI类没有启动

I want to setup FPDI in my localhost but its gives me an error.

Fatal error: Class 'FPDF' not found in C:\wamp\www\book\fpdf_tpl.php on line 20

This is what I did:
I went to download page, I downloaded 2 packs (FPDF_TPL and FPDI) and unziped them into my localhost.
Then I made a example page:

<?php
    require_once('fpdf.php');
    require_once('fpdi.php');

    // initiate FPDI
    $pdf = new FPDI();

    // add a page
    $pdf->AddPage();

    // set the source file
    $pdf->setSourceFile("PdfDocument.pdf");

    // import page 1
    $tplIdx = $pdf->importPage(1);

    // use the imported page and place it at point 10,10 with a width of 100 mm
    $pdf->useTemplate($tplIdx, 10, 10, 100);

    // now write some text above the imported page
    $pdf->SetFont('Helvetica');
    $pdf->SetTextColor(255, 0, 0);
    $pdf->SetXY(30, 30);
    $pdf->Write(0, 'This is just a simple text');

    pdf->Output();

I did what the site says, but I had an error:

Fatal error: Class 'FPDF' not found in C:\wamp\www\book\fpdf_tpl.php on line 20

I have searched the error codes, but I can not figure it out.
Is there anybody experienced with FPDI ?

  • 写回答

3条回答 默认 最新

  • duanlu1950 2013-11-05 09:08
    关注

    You have to download the library in the page Download and extract it to your folder. Then the code should work. Make sure you put the correct path for require_once.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据