mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00
Added an example of creating PDF documents in memory.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@43869 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
99b15e13f5
commit
6229a009fc
1 changed files with 30 additions and 0 deletions
|
@ -1530,6 +1530,36 @@ PDF_delete($pdf);
|
|||
must be fetched by the client with the
|
||||
<function>PDF_get_buffer</function> function.
|
||||
</para>
|
||||
<para>
|
||||
The following example shows how to create a pdf document in memory
|
||||
and how to output it correctly.
|
||||
<example>
|
||||
<title>Creating a PDF document in memory</title>
|
||||
<programlisting role="php">
|
||||
<?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;
|
||||
|
||||
?>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue