<?php
//Código necessário para funcionamento correto no IE
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=arquivo.pdf");
try {
$p = new PDFlib();
//Cria um novo arquivo PDF;
if ($p->begin_document("", "") == 0) {
die("Error: " . $p->get_errmsg());
}
$p->set_info("Creator", "arquivo.php");
$p->set_info("Author", "Nome do Autor");
$p->set_info("Title", "Locaweb!");
$p->begin_page_ext(595, 842, "");
$font = $p->load_font("Helvetica-Bold", "winansi", "");
$p->setfont($font, 24.0);
$p->set_text_pos(50, 700);
$p->show("Locaweb!");
$p->continue_text("(PDF gerado através do PHP)");
$p->end_page_ext("");
$p->end_document("");
$buf = $p->get_buffer();
$len = strlen($buf);
print $buf;
}
catch (PDFlibException $e) {
die("PDFlib: ocorreu um erro neste exemplo:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");
}
catch (Exception $e) {
die($e);
}
$p = 0;
?>
file:///C|/Users/TI02.TI02-PC/Desktop/teste.php.txt[23/12/2009 21:54:41]
Download

para funcionamento correto no IE