source: trunk/filemanager/tp/dompdf/include/canvas.cls.php @ 2000

Revision 2000, 7.3 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implementação do módulo gerenciador de arquivos

Line 
1<?php
2/**
3 * DOMPDF - PHP5 HTML to PDF renderer
4 *
5 * File: $RCSfile: canvas.cls.php,v $
6 * Created on: 2004-06-06
7 *
8 * Copyright (c) 2004 - Benj Carson <benjcarson@digitaljunkies.ca>
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library in the file LICENSE.LGPL; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
23 * 02111-1307 USA
24 *
25 * Alternatively, you may distribute this software under the terms of the
26 * PHP License, version 3.0 or later.  A copy of this license should have
27 * been distributed with this file in the file LICENSE.PHP .  If this is not
28 * the case, you can obtain a copy at http://www.php.net/license/3_0.txt.
29 *
30 * The latest version of DOMPDF might be available at:
31 * http://www.digitaljunkies.ca/dompdf
32 *
33 * @link http://www.digitaljunkies.ca/dompdf
34 * @copyright 2004 Benj Carson
35 * @author Benj Carson <benjcarson@digitaljunkies.ca>
36 * @package dompdf
37 * @version 0.5.1
38 */
39
40/* $Id: canvas.cls.php 186 2009-10-19 22:42:06Z eclecticgeek@gmail.com $ */
41
42/**
43 * Main rendering interface
44 *
45 * Currently {@link CPDF_Adapter}, {@link PDFLib_Adapter}, {@link TCPDF_Adapter}, and {@link GD_Adapter}
46 * implement this interface.
47 *
48 * Implementations should measure x and y increasing to the left and down,
49 * respectively, with the origin in the top left corner.  Implementations
50 * are free to use a unit other than points for length, but I can't
51 * guarantee that the results will look any good.
52 *
53 * @package dompdf
54 */
55interface Canvas {
56
57  /**
58   * Returns the current page number
59   *
60   * @return int
61   */
62  function get_page_number();
63
64  /**
65   * Returns the total number of pages
66   *
67   * @return int
68   */
69  function get_page_count();
70
71  /**
72   * Sets the total number of pages
73   *
74   * @param int $count
75   */
76  function set_page_count($count);
77
78  /**
79   * Draws a line from x1,y1 to x2,y2
80   *
81   * See {@link Style::munge_colour()} for the format of the colour array.
82   * See {@link Cpdf::setLineStyle()} for a description of the format of the
83   * $style parameter (aka dash).
84   *
85   * @param float $x1
86   * @param float $y1
87   * @param float $x2
88   * @param float $y2
89   * @param array $color
90   * @param float $width
91   * @param array $style
92   */
93  function line($x1, $y1, $x2, $y2, $color, $width, $style = null);
94
95  /**
96   * Draws a rectangle at x1,y1 with width w and height h
97   *
98   * See {@link Style::munge_colour()} for the format of the colour array.
99   * See {@link Cpdf::setLineStyle()} for a description of the $style
100   * parameter (aka dash)
101   *
102   * @param float $x1
103   * @param float $y1
104   * @param float $w
105   * @param float $h
106   * @param array $color
107   * @param float $width
108   * @param array $style
109   */   
110  function rectangle($x1, $y1, $w, $h, $color, $width, $style = null);
111
112  /**
113   * Draws a filled rectangle at x1,y1 with width w and height h
114   *
115   * See {@link Style::munge_colour()} for the format of the colour array.
116   *
117   * @param float $x1
118   * @param float $y1
119   * @param float $w
120   * @param float $h
121   * @param array $color
122   */   
123  function filled_rectangle($x1, $y1, $w, $h, $color);
124
125  /**
126   * Draws a polygon
127   *
128   * The polygon is formed by joining all the points stored in the $points
129   * array.  $points has the following structure:
130   * <code>
131   * array(0 => x1,
132   *       1 => y1,
133   *       2 => x2,
134   *       3 => y2,
135   *       ...
136   *       );
137   * </code>
138   *
139   * See {@link Style::munge_colour()} for the format of the colour array.
140   * See {@link Cpdf::setLineStyle()} for a description of the $style
141   * parameter (aka dash)   
142   *
143   * @param array $points
144   * @param array $color
145   * @param float $width
146   * @param array $style
147   * @param bool  $fill  Fills the polygon if true
148   */
149  function polygon($points, $color, $width = null, $style = null, $fill = false);
150
151  /**
152   * Draws a circle at $x,$y with radius $r
153   *
154   * See {@link Style::munge_colour()} for the format of the colour array.
155   * See {@link Cpdf::setLineStyle()} for a description of the $style
156   * parameter (aka dash)
157   *
158   * @param float $x
159   * @param float $y
160   * @param float $r
161   * @param array $color
162   * @param float $width
163   * @param array $style
164   * @param bool $fill Fills the circle if true   
165   */   
166  function circle($x, $y, $r, $color, $width = null, $style = null, $fill = false);
167
168  /**
169   * Add an image to the pdf.
170   *
171   * The image is placed at the specified x and y coordinates with the
172   * given width and height.
173   *
174   * @param string $img_url the path to the image
175   * @param string $img_type the type (e.g. extension) of the image
176   * @param float $x x position
177   * @param float $y y position
178   * @param int $w width (in pixels)
179   * @param int $h height (in pixels)
180   */
181  function image($img_url, $img_type, $x, $y, $w, $h);
182
183  /**
184   * Writes text at the specified x and y coordinates
185   *
186   * See {@link Style::munge_colour()} for the format of the colour array.
187   *
188   * @param float $x
189   * @param float $y
190   * @param string $text the text to write
191   * @param string $font the font file to use
192   * @param float $size the font size, in points
193   * @param array $color
194   * @param float $adjust word spacing adjustment
195   */
196  function text($x, $y, $text, $font, $size, $color = array(0,0,0), $adjust = 0);
197
198  /**
199   * Add a named destination (similar to <a name="foo">...</a> in html)
200   *
201   * @param string $anchorname The name of the named destination
202   */
203  function add_named_dest($anchorname);
204
205  /**
206   * Add a link to the pdf
207   *
208   * @param string $url The url to link to
209   * @param float  $x   The x position of the link
210   * @param float  $y   The y position of the link
211   * @param float  $width   The width of the link
212   * @param float  $height   The height of the link
213   */
214  function add_link($url, $x, $y, $width, $height);
215 
216  /**
217   * Calculates text size, in points
218   *
219   * @param string $text the text to be sized
220   * @param string $font the desired font
221   * @param float  $size the desired font size
222   * @param float  $spacing word spacing, if any
223   * @return float
224   */
225  function get_text_width($text, $font, $size, $spacing = 0);
226
227  /**
228   * Calculates font height, in points
229   *
230   * @param string $font
231   * @param float $size
232   * @return float
233   */
234  function get_font_height($font, $size);
235
236 
237  /**
238   * Starts a new page
239   *
240   * Subsequent drawing operations will appear on the new page.
241   */
242  function new_page();
243
244  /**
245   * Streams the PDF directly to the browser
246   *
247   * @param string $filename the name of the PDF file
248   * @param array  $options associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0
249   */
250  function stream($filename, $options = null);
251
252  /**
253   * Returns the PDF as a string
254   *
255   * @param array  $options associative array: 'compress' => 1 or 0
256   * @return string
257   */
258  function output($options = null);
259 
260}
261?>
Note: See TracBrowser for help on using the repository browser.