pdf_open_file
(PHP 4 >= 4.0.5, PECL)
pdf_open_file -- 新規PDFオブジェクトをオープンする
説明
int
pdf_open_file ( int pdf object [, string filename] )
新規のPDFファイルを指定したファイル名で作成します。
filename が空の場合、PDFドキュメントはファ
イルではなくメモリ上に作成されます。結果は、
pdf_get_buffer()関数によりクライアント側で取得
可能です。
PDFドキュメントをメモリ内に作成し、正しく出力する方法を示す例を以
下に示します。
例 1. PDFドキュメントをメモリ内に作成する
<?php
$pdf = pdf_new();
pdf_open_file($pdf); pdf_begin_page($pdf, 595, 842); pdf_set_font($pdf, "Times-Roman", 30, "host"); pdf_set_value($pdf, "textrendering", 1); pdf_show_xy($pdf, "A PDF document created in memory!", 50, 750); pdf_end_page($pdf); pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header("Content-type: application/pdf"); header("Content-disposition: inline; filename=test.pdf"); header("Content-length: " . strlen($data));
echo $data;
?>
|
|