Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » How to Edit Existing pdf using fpdf Library in PHP(How to Edit Existing pdf using fpdf Library in PHP)
How to Edit Existing pdf using fpdf Library in PHP [message #1707269] Thu, 03 September 2015 11:35 Go to next message
Ranjeet Kumar is currently offline Ranjeet KumarFriend
Messages: 6
Registered: August 2015
Junior Member
By the help of FPDI library, I tried to write some exsiting pdf files but able to wirte only single page of pdf.
Below is my code:

<?php
require_once '../includes/fpdf/fpdf.php';
require_once 
'../includes/fpdf/fpdi.php';
$pdf = new FPDI();
$pageCount $pdf->setSourceFile("contractFinalTrans.pdf");
$tplIdx $pdf->importPage(1);
$pdf->addPage();
$pdf->useTemplate($tplIdx1010200);
//set position in pdf document
// now write some text above the imported page
//$pdf->SetFont('Arial');
$pdf->SetFontSize(10);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(5050);
$pdf->Write(0"page 1");///print this output
$pdf->SetAutoPageBreak(true,22);
$pdf->addPage();
$tplIdx $pdf->importPage(2);
//$pdf->addPage();
$pdf->useTemplate($tplIdx1010200);
//set position in pdf document
// now write some text above the imported page
//$pdf->SetFont('Arial');
$pdf->SetFontSize(10);
$pdf->SetTextColor(255,0,0);
$pdf->SetXY(100 100);
$pdf->Write(0"page 2");
$pdf->Output();
?>


Can anyone suggest me how to Edit Existing multiple pdf using fpdf Library in PHP

I have explored many php developer forum related to this issue but I am unable to get satisfactory solutions. Hope this forum help me out for the same issue.
Re: How to Edit Existing pdf using fpdf Library in PHP [message #1707370 is a reply to message #1707269] Fri, 04 September 2015 09:24 Go to previous messageGo to next message
Kelvin Smith is currently offline Kelvin SmithFriend
Messages: 7
Registered: April 2015
Location: Suite 1, 7 Commercial Str...
Junior Member

Any error? Are you using demo version?
Re: How to Edit Existing pdf using fpdf Library in PHP [message #1707622 is a reply to message #1707370] Tue, 08 September 2015 03:57 Go to previous message
fathy Sakr is currently offline fathy SakrFriend
Messages: 2
Registered: September 2015
Junior Member
Try following

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

$pdf =& new FPDI();
$pdf->AddPage();
Use this page as template, then

$pdf->setSourceFile($filename);
// import page 1
$tplIdx = $pdf->importPage(1);
//use the imported page and place it at point 0,0; calculate width and height
//automaticallay and ajust the page size to the size of the imported page
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
Let me know if you have any errors
Previous Topic:Eclipse, PHP, mySQL and WAMP Server
Next Topic:Toggle Comment on latest Eclipse for PHP
Goto Forum:
  


Current Time: Tue Apr 16 04:53:37 GMT 2024

Powered by FUDForum. Page generated in 0.55798 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top