4 * @link http://dompdf.github.com/
5 * @author Benj Carson <benjcarson@digitaljunkies.ca>
6 * @author Fabien Ménager <fabien.menager@gmail.com>
7 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
13 * Main rendering interface
15 * Currently {@link Dompdf\Adapter\CPDF}, {@link Dompdf\Adapter\PDFLib}, and {@link Dompdf\Adapter\GD}
16 * implement this interface.
18 * Implementations should measure x and y increasing to the left and down,
19 * respectively, with the origin in the top left corner. Implementations
20 * are free to use a unit other than points for length, but I can't
21 * guarantee that the results will look any good.
27 function __construct($paper = "letter", $orientation = "portrait", Dompdf
$dompdf);
32 function get_dompdf();
35 * Returns the current page number
39 function get_page_number();
42 * Returns the total number of pages
46 function get_page_count();
49 * Sets the total number of pages
53 function set_page_count($count);
56 * Draws a line from x1,y1 to x2,y2
58 * See {@link Style::munge_color()} for the format of the color array.
59 * See {@link Cpdf::setLineStyle()} for a description of the format of the
60 * $style parameter (aka dash).
70 function line($x1, $y1, $x2, $y2, $color, $width, $style = null);
73 * Draws a rectangle at x1,y1 with width w and height h
75 * See {@link Style::munge_color()} for the format of the color array.
76 * See {@link Cpdf::setLineStyle()} for a description of the $style
77 * parameter (aka dash)
87 function rectangle($x1, $y1, $w, $h, $color, $width, $style = null);
90 * Draws a filled rectangle at x1,y1 with width w and height h
92 * See {@link Style::munge_color()} for the format of the color array.
100 function filled_rectangle($x1, $y1, $w, $h, $color);
103 * Starts a clipping rectangle at x1,y1 with width w and height h
110 function clipping_rectangle($x1, $y1, $w, $h);
113 * Starts a rounded clipping rectangle at x1,y1 with width w and height h
126 function clipping_roundrectangle($x1, $y1, $w, $h, $tl, $tr, $br, $bl);
129 * Ends the last clipping shape
131 function clipping_end();
146 function rotate($angle, $x, $y);
151 function skew($angle_x, $angle_y, $x, $y);
156 function scale($s_x, $s_y, $x, $y);
161 function translate($t_x, $t_y);
166 function transform($a, $b, $c, $d, $e, $f);
171 * The polygon is formed by joining all the points stored in the $points
172 * array. $points has the following structure:
182 * See {@link Style::munge_color()} for the format of the color array.
183 * See {@link Cpdf::setLineStyle()} for a description of the $style
184 * parameter (aka dash)
186 * @param array $points
187 * @param array $color
188 * @param float $width
189 * @param array $style
190 * @param bool $fill Fills the polygon if true
192 function polygon($points, $color, $width = null, $style = null, $fill = false);
195 * Draws a circle at $x,$y with radius $r
197 * See {@link Style::munge_color()} for the format of the color array.
198 * See {@link Cpdf::setLineStyle()} for a description of the $style
199 * parameter (aka dash)
204 * @param array $color
205 * @param float $width
206 * @param array $style
207 * @param bool $fill Fills the circle if true
209 function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false);
212 * Add an image to the pdf.
214 * The image is placed at the specified x and y coordinates with the
215 * given width and height.
217 * @param string $img_url the path to the image
218 * @param float $x x position
219 * @param float $y y position
220 * @param int $w width (in pixels)
221 * @param int $h height (in pixels)
222 * @param string $resolution The resolution of the image
224 function image($img_url, $x, $y, $w, $h, $resolution = "normal");
227 * Add an arc to the PDF
228 * See {@link Style::munge_color()} for the format of the color array.
230 * @param float $x X coordinate of the arc
231 * @param float $y Y coordinate of the arc
232 * @param float $r1 Radius 1
233 * @param float $r2 Radius 2
234 * @param float $astart Start angle in degrees
235 * @param float $aend End angle in degrees
236 * @param array $color Color
237 * @param float $width
238 * @param array $style
242 function arc($x, $y, $r1, $r2, $astart, $aend, $color, $width, $style = array());
245 * Writes text at the specified x and y coordinates
246 * See {@link Style::munge_color()} for the format of the color array.
250 * @param string $text the text to write
251 * @param string $font the font file to use
252 * @param float $size the font size, in points
253 * @param array $color
254 * @param float $word_space word spacing adjustment
255 * @param float $char_space char spacing adjustment
256 * @param float $angle angle
260 function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $word_space = 0.0, $char_space = 0.0, $angle = 0.0);
263 * Add a named destination (similar to <a name="foo">...</a> in html)
265 * @param string $anchorname The name of the named destination
267 function add_named_dest($anchorname);
270 * Add a link to the pdf
272 * @param string $url The url to link to
273 * @param float $x The x position of the link
274 * @param float $y The y position of the link
275 * @param float $width The width of the link
276 * @param float $height The height of the link
280 function add_link($url, $x, $y, $width, $height);
283 * Add meta information to the pdf
285 * @param string $name Label of the value (Creator, Producer, etc.)
286 * @param string $value The text to set
288 function add_info($name, $value);
291 * Calculates text size, in points
293 * @param string $text the text to be sized
294 * @param string $font the desired font
295 * @param float $size the desired font size
296 * @param float $word_spacing word spacing, if any
297 * @param float $char_spacing
301 function get_text_width($text, $font, $size, $word_spacing = 0.0, $char_spacing = 0.0);
304 * Calculates font height, in points
306 * @param string $font
311 function get_font_height($font, $size);
314 * Calculates font baseline, in points
316 * @param string $font
321 function get_font_baseline($font, $size);
324 * Returns the font x-height, in points
326 * @param string $font
331 //function get_font_x_height($font, $size);
336 * @param float $opacity
337 * @param string $mode
339 function set_opacity($opacity, $mode = "Normal");
342 * Sets the default view
344 * @param string $view
345 * 'XYZ' left, top, zoom
349 * 'FitR' left,bottom,right
353 * @param array $options
357 function set_default_view($view, $options = array());
360 * @param string $script
364 function javascript($script);
369 * Subsequent drawing operations will appear on the new page.
374 * Streams the PDF directly to the browser
376 * @param string $filename the name of the PDF file
377 * @param array $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0
379 function stream($filename, $options = null);
382 * Returns the PDF as a string
384 * @param array $options associative array: 'compress' => 1 or 0
387 function output($options = null);