Raport in PDF

PEAR, Smarty, ADOdb, OOP, PHP 5, XML, UML, Şabloane de proiectare, PHP-GTK.

Moderatori: coditza, Emil, Moderatori

ynfonet
Senior Member
Mesaje: 245
Membru din: Mie Dec 14, 2005 8:00 am

Raport in PDF

Mesajde ynfonet » Mie Ian 10, 2007 10:17 am

Buna ziua & LMA.

Am pe WinXP instalat WAMP.

Vreau sa fac listari la anumite rapoarte dar sa fie in format txt, de preferinta PDF (nu vreau sa listez direct din brows-er).

Am cautat pe forum & net dar nu reusesc sai dau de capat.

Ce anume mai trb. instalat sau setat?

Stie cineva ce trb. sa fac?

Multumesc.



Daemon7
PHPRomania Supporter
Mesaje: 21
Membru din: Joi Iul 21, 2005 5:22 pm
Localitate: Timisoara
Contact:

Mesajde Daemon7 » Mie Ian 10, 2007 11:57 am

Poti sa folsesti functiile incluse in PHP pt generare de pdf-uri:
http://www.php.net/manual/en/ref.pdf.php

sau poti sa folosesti o clasa independenta, iti recomand fpdf :
www.fpdf.org
Best regards,
Lapadat Bogdan aka Daemon7
www.lapadatbogdan.srv.ro

ynfonet
Senior Member
Mesaje: 245
Membru din: Mie Dec 14, 2005 8:00 am

Mesajde ynfonet » Mie Ian 17, 2007 4:54 pm

Buna ziua.

Am activat in WAMP versiunea 1.6.6. (Apache 2.0.59(Win32), PHP 5.2.0), php.ini urm. dll-uri:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

extension=php_cpdf.dll
extension=php_pdf.dll

Insa la rularea scriptului:

<?php
$p = PDF_new();

/* open new PDF file; insert a file name to create the PDF on disk */
if (PDF_begin_document($p, "", "") == 0) {
die("Error: " . PDF_get_errmsg($p));
}

PDF_set_info($p, "Creator", "hello.php");
PDF_set_info($p, "Author", "Rainer Schaaf");
PDF_set_info($p, "Title", "Hello world (PHP)!");

PDF_begin_page_ext($p, 595, 842, "");

$font = PDF_load_font($p, "Helvetica-Bold", "winansi", "");

PDF_setfont($p, $font, 24.0);
PDF_set_text_pos($p, 50, 700);
PDF_show($p, "Hello world!");
PDF_continue_text($p, "(says PHP)");
PDF_end_page_ext($p, "");

PDF_end_document($p, "");

$buf = PDF_get_buffer($p);
$len = strlen($buf);

header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;

PDF_delete($p);
?>


imi da urm. meg. de err.:

Call to undefined function PDF_begin_document() in scriptul de mai sus

si se refera la linia:

if (PDF_begin_document($p, "", "") == 0) {

Ce nu am facut?

Unde gresesc?

Mai trb. setat ceva, instalat ceva?

Multumesc.

Daemon7
PHPRomania Supporter
Mesaje: 21
Membru din: Joi Iul 21, 2005 5:22 pm
Localitate: Timisoara
Contact:

Mesajde Daemon7 » Mie Ian 17, 2007 5:33 pm

S-ar putea sa fie vorba despre asta (extras din http://www.php.net/manual/en/ref.pdf.php )

In PHP 4, first a PDF resource has to be retrieved with a function call like
$p = PDF_new().
This PDF resource is used as the first parameter in all further function calls, such as in
PDF_begin_document($p, "", "").
In PHP 5 however, a PDFlib object is created with
$p = new PDFlib().

Din cate am vazut eu tu ai PHP 5
Best regards,

Lapadat Bogdan aka Daemon7

www.lapadatbogdan.srv.ro


Înapoi la “PHP Avansat”

Cine este conectat

Utilizatori ce ce navighează pe acest forum: Niciun utilizator înregistrat și 6 vizitatori