2 require_once("../dompdf_config.inc.php");
3 if ( isset( $_POST["html"] ) ) {
5 if ( get_magic_quotes_gpc() )
6 $_POST["html"] = stripslashes($_POST["html"]);
8 $old_limit = ini_set("memory_limit", "16M");
10 $dompdf = new DOMPDF();
11 $dompdf->load_html($_POST["html"]);
12 $dompdf->set_paper($_POST["paper"], $_POST["orientation"]);
15 $dompdf->stream("dompdf_out.pdf");
21 <?php
include("head.inc"); ?
>
23 <h2
>On this page
:</h2
>
25 <?php
echo li_arrow() ?
><a href
="#samples">Samples
</a
></li
>
26 <?php
echo li_arrow() ?
><a href
="#demo">Demo
</a
></li
>
30 <a name
="samples"> </a
>
33 <p
>Below are some sample files
. The PDF version is generated on the fly by dompdf
. (The source HTML
&
; CSS
for
34 these files is included in the test
/ directory of the distribution
39 $test_files = glob(dirname(__FILE__
) . "/test/*.{html,php}", GLOB_BRACE
);
40 $dompdf = dirname(dirname($_SERVER["PHP_SELF"])) . "/dompdf.php?base_path=" . rawurlencode("www/test/");
41 foreach ( $test_files as $file ) {
42 $file = basename($file);
43 $arrow = "images/arrow_0" . rand(1, 6) . ".gif";
44 echo "<li style=\"list-style-image: url('$arrow');\">\n";
46 echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("www/test/$file") . "\">PDF</a>]\n";
54 <p
>Enter your html snippet in the text box below to see it rendered
as a
55 PDF
: (Note by
default, remote stylesheets
, images
&
; are disabled
.)</p
>
57 <form action
="<?php echo $_SERVER["PHP_SELF
"];?>" method
="post">
59 <p
>Paper size
and orientaion
:
62 foreach ( array_keys(CPDF_Adapter
::$PAPER_SIZES) as $size )
63 echo "<option ". ($size == "letter" ?
"selected " : "" ) . "value=\"$size\">$size</option>\n";
66 <select name
="orientation">
67 <option value
="portrait">portrait
</option
>
68 <option value
="landscape">landscape
</option
>
72 <textarea name
="html" cols
="60" rows
="20">
77 /* Type some style rules here */
84 <
;!-- Type some HTML here
-->
;
90 <div style
="text-align: center; margin-top: 1em;">
91 <input type
="submit" name
="submit" value
="submit"/>
95 <p style
="font-size: 0.65em; text-align: center;">(Note
: if you
use a KHTML
96 based browser
and are having difficulties loading the sample output
, try
97 saving it to a file first
.)</p
>
99 <?php
include("foot.inc"); ?
>