• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP 合并两个PDF成一个PDF文件利器 FPDI

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_23803845.html

http://www.setasign.de/products/pdf-php-solutions/fpdi/manuals/

http://www.setasign.de/products/pdf-php-solutions/

Php FPDI and FPDF open pdf file and edit one page?

Asked by galic1987 in PHP Scripting Language

I use this FPDI and FPDF script (in code snippet) to open pdf file and to stamp it in php, but there is the problem with the server "internal server error" when i try to stamp pdf file with 130 pages. AND there is the problem if i try to join this 130 pages as well without stamping. (the problem is on hosting server, it works on localhost)

so i wanted to open pdf file and parse it back with  file_get_contents($filename) and i wrote ... 

$my_file = file_get_contents($filename);
$pdf =& new FPDF();
$pdf->buffer = $my_file;  
$pdf->Output($name."_go.pdf", \'D\');

and its working! but...
i want now to stamp just one page, is that possible? how can i do that ?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
$pdf =& new FPDI();
               
               
               
// set the sourcefile
                $pages
=$pdf->setSourceFile($filename);
               
                         
               
               
               
// import pages one after the other
               
for($i = 1; $i < $pages; $i ++) {
                   
// add a page
                   
//echo memory_get_usage() . "\n";
                    $pdf
->AddPage();
                    $tplIdx
= $pdf->importPage($i);
                   
// use the imported page and place it at point 10,10 with a width of 100 mm
                    $pdf
->useTemplate($tplIdx);
                        echo memory_get_usage
();
                   
// write text with link to www.fpdf.org website
                    $pdf
->SetFont(\'Arial\');
                    $pdf
->SetTextColor(255,102,102);
                    $pdf
->SetXY(15, 15); // X (cm),  Y (cm)
                    $pdf
->Write(0,$signature_text,\'http://www.address.cc\');
 
                   
//$pdf->Write(0,\'w w w . f p d f . o r g\');
               
}
                $pdf
->Output(\'newpdf.pdf\', \'D\');



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP核心编程知识点发布时间:2022-07-10
下一篇:
搭建PHP开发环境(Apache+PHP)(一)发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap