PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Nov 18, 2019 8:18 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Feb 03, 2005 10:18 am 
Offline
Admin
User avatar

Joined: Wed Aug 13, 2003 7:02 am
Posts: 4522
Location: York, UK
First of all, download both the following packages

http://www.fpdf.org/

http://fpdi.setasign.de/index.php?p=home


Extract both packages into the same folder.

Put the PDF you want to add text to in the same folder and call it test1.pdf

Create a new script in the same folder called demo.php and add the following code.

Syntax: [ Download ] [ Hide ]
define('FPDF_FONTPATH','font/');

require('fpdi.php');



class PDF extends fpdi

{

//Page header

function Header()

{

    //Logo

    //$this->Image('logo_pb.png',10,8,33);

    //Arial bold 15

    //$this->SetFont('Arial','B',15);

    //Move to the right

    //$this->Cell(80);

    //Title

    //$this->Cell(30,10,'Title',1,0,'C');

    //Line break

    //$this->Ln(20);

}



//Page footer

function Footer()

{

    //Position at 1.5 cm from bottom

    $this->SetY(-15);

    //Arial italic 8

    $this->SetFont('Arial','I',8);

    //Page number

    $this->Cell(0,10,'This document was downloaded at '.date("G:i T", time()).' on '.date("l F jS Y", time()).'. This document is only valid for 24 hours from this date.',0,0,'C');

}

}



$pdf= new PDF();



$pagecount = $pdf->setSourceFile("test1.pdf");





for ($i=1; $i <= $pagecount; $i++) {



        $tplidx = $pdf->ImportPage(1);



        $pdf->addPage();

        $pdf->useTemplate($tplidx,0,0,0);

}





$pdf->Output("newpdf.pdf","I");


Easy peasy...obviously there is loads more you can do with this, but this should get ya started.

Uncomment the header function and change the image name to one that exists to add images!

Mark


Last edited by JayBird on Tue Dec 20, 2005 6:13 am, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 03, 2005 4:21 pm 
Offline
Jedi Mod
User avatar

Joined: Tue Dec 21, 2004 6:03 pm
Posts: 5263
Location: usrlab.com
Thats mightily cool. I might be doing client reports in PDF format after I've had a play..

Maybe..


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 1:50 am 
Offline
DevNet Resident
User avatar

Joined: Fri Dec 24, 2004 3:59 am
Posts: 1452
Location: Lucknow, UP, India
Plz Tell me how I can insert SVG graphics into PDF using any of the PDF lib available out there.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 05, 2005 7:06 am 
Offline
DevNet Resident
User avatar

Joined: Fri Dec 24, 2004 3:59 am
Posts: 1452
Location: Lucknow, UP, India


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 05, 2005 8:10 am 
Offline
Forum Donator

Joined: Mon Oct 20, 2003 8:31 pm
Posts: 1661
Location: Maine, USA


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 05, 2005 8:14 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 12:16 am 
Offline
Forum Contributor
User avatar

Joined: Mon Jun 14, 2004 10:39 am
Posts: 259
Location: Amerika


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 12:26 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 3:19 am 
Offline
Forum Contributor
User avatar

Joined: Mon Jun 14, 2004 10:39 am
Posts: 259
Location: Amerika
hmm.. I suppose I read it wrong but I assumed he would mov the SVG file bits into a container in his script and then tell the browser that it is either jpeg or png bits and thus would pass the server check for png or jpeg (depending on the gped version his server has) and would then pipe those bits into his PDF. It was only a suggestion.. perhaps a bad one? :)

regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 1:18 am 
Offline
DevNet Resident
User avatar

Joined: Fri Dec 24, 2004 3:59 am
Posts: 1452
Location: Lucknow, UP, India


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 2:26 am 
Offline
DevNet Resident
User avatar

Joined: Fri Dec 24, 2004 3:59 am
Posts: 1452
Location: Lucknow, UP, India
I am still stuck at the same point. Feyd, please see if you can turn up something on this matter. It would be a great help for me.
Thanx


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 2:41 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 2:54 am 
Offline
DevNet Resident
User avatar

Joined: Fri Dec 24, 2004 3:59 am
Posts: 1452
Location: Lucknow, UP, India


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 7:08 am 
Offline
Forum Newbie

Joined: Fri May 18, 2007 3:13 am
Posts: 9


Last edited by dermoritz on Fri May 18, 2007 7:29 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 7:15 am 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group