CodeIgniter Forums
trying to creATE A PDF FILE USING PHP and CodeIgniter. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: trying to creATE A PDF FILE USING PHP and CodeIgniter. (/thread-8750.html)



trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-29-2008

[eluser]RaiNnTeaRs[/eluser]
Code:
$pdf = pdf_new();
    pdf_open_file($pdf,"http://192.168.1.188/ci2/report/report.pdf");
    pdf_set_info($pdf, "Author", "Sales-admin");
    pdf_set_info($pdf, "Title", "Confirmation report");
    pdf_set_info($pdf, "Creator", "www.a.com");
    pdf_set_info($pdf, "Subject", "Order Confirmation");
    
    pdf_begin_page($pdf, 595, 842);

My error message:
Fatal error: Uncaught exception 'PDFlibException' with message 'Function must not be called in 'object' scope' in C:\xampp\htdocs\ci2\system\application\controllers\dojang.php:1019 Stack trace: #0 C:\xampp\htdocs\ci2\system\application\controllers\dojang.php(1019): pdf_begin_page() #1 C:\xampp\htdocs\ci2\system\codeigniter\CodeIgniter.php(224): Dojang->report(Resource id #48, 595, 842) #2 C:\xampp\htdocs\ci2\index.php(115): require_once('C:\xampp\htdocs...') #3 {main} thrown in C:\xampp\htdocs\ci2\system\application\controllers\dojang.php on line 1019


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-29-2008

[eluser]RaiNnTeaRs[/eluser]
or does anyone know any idea to create a pd file using codeigniter ? Deadline is coming, help me plz T-T. Thanks.


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-30-2008

[eluser]Crimp[/eluser]
I use DomPDF as a CI plug-in. Information is on the CI wiki.


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-30-2008

[eluser]Michael Wales[/eluser]
You can also check-out the source for BambooInvoice - a great example of how to make PDFs (if I remember correctly it uses views to do so).


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-30-2008

[eluser]RaiNnTeaRs[/eluser]
oe thx. Do I need some libraries to do so ? or can i use some plain Php Coding ? Thx


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-30-2008

[eluser]Derek Allard[/eluser]
There are extensions built into some PHP installs, but in general you'll need a library. Did you look at the sources offered above, I think you'll find they're a good direction for you.


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-31-2008

[eluser]RaiNnTeaRs[/eluser]
Wow... Mr.Derek Allard,my favorite CodeIgniter's author ^^.Thx for replying sir. finally I;ve managed to installed the pdflib, but i got some major problems : Couldn't open font file '/home/rnbtaekw/public_html/font/' ( in pdf_findfont command)


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 05-31-2008

[eluser]Derek Allard[/eluser]
What generated that RaiNnTeaRs (that's surprisingly difficult to type). Was it one of thee resources listed?


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 06-01-2008

[eluser]RaiNnTeaRs[/eluser]
lol.. I change my lines it into
Code:
pdf_set_parameter($pdf, 'FontOutline', 'Arial=/home/rnbtaekw/public_html/Font/arial.ttf');
$arial = pdf_findfont($pdf, "Arial", "host", 1);
and it works well, what troubles me now is that
pdf invert the Y coordinates ( bottom pages = (y=0) ),
and also I cant overwrite it..

I want to create report.pdf that can be overwritten ( changes every times I create new report ). Consist of some pages (if it has alot of records).

How can I overwrite my pdf files, and create new pages with it. Thanks.


trying to creATE A PDF FILE USING PHP and CodeIgniter. - El Forum - 06-01-2008

[eluser]RaiNnTeaRs[/eluser]
Finally I delete my PDF files using FTP, and create a new pdf files. But the problem now is I dunno how to draw a fill rectangle, I've read the PDF_ PHP Manual , buat none was satisfactory. Can anyone help.. ^^