小编hit*_*202的帖子

具有多页的FPDI

我是PHP的新手,在插入多个页面时使用FPDI有点困难.

我有一个.pdf文件,包含3页.我最终将第1页保存为3中的单独页面并且与我的代码一起使用,但这是因为我的代码仅适用于1页.当我将其更改回3页文件时,它会给我一个内部服务器错误.

这是我正在使用的代码:

<?php

require_once('prog/fpdf.php');
require_once('prog/fpdi.php');

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

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

// set the source file
$pdf->setSourceFile("apps/Par.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, null, null, 0, 0, true);

// font and color selection
$pdf->SetFont('Helvetica');
$pdf->SetTextColor(200, 0, 0);

// now write some text above the imported page
$pdf->SetXY(40, 83);
$pdf->Write(2, 'THIS IS JUST A TEST'); …
Run Code Online (Sandbox Code Playgroud)

html php pdf fpdf fpdi

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

fpdf ×1

fpdi ×1

html ×1

pdf ×1

php ×1