1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: namespace Xoops\Core\Service\Contract;
13:
14: /**
15: * HtmlToPdf service interface
16: *
17: * @category Xoops\Core\Service\Contract\HtmlToPdfInterface
18: * @package Xoops\Core
19: * @author Richard Griffith <richard@geekwright.com>
20: * @copyright 2014 The XOOPS Project https://github.com/XOOPS/XoopsCore
21: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
22: * @version Release: 1.0
23: * @link http://xoops.org
24: * @since 2.6.0
25: */
26: interface HtmlToPdfInterface
27: {
28: const MODE = \Xoops\Core\Service\Manager::MODE_EXCLUSIVE;
29:
30: /**
31: * startPdf - start a new pdf
32: *
33: * @param Response $response \Xoops\Core\Service\Response object
34: *
35: * @return void
36: */
37: public function startPdf($response);
38:
39: /**
40: * setPageOrientation - set page orientation
41: *
42: * @param Response $response \Xoops\Core\Service\Response object
43: * @param string $pageOrientation page orientation, 'P' for portrait, 'L' for landscape
44: *
45: * @return void
46: */
47: public function setPageOrientation($response, $pageOrientation);
48:
49: /**
50: * setPageSize - set standard page size
51: *
52: * @param Response $response \Xoops\Core\Service\Response object
53: * @param string $pageSize standard named page size, i.e. 'LETTER', 'A4', etc.
54: *
55: * @return void
56: */
57: public function setPageSize($response, $pageSize);
58:
59: /**
60: * setBaseUnit - set unit of measure for page size, margins, etc.
61: *
62: * @param Response $response \Xoops\Core\Service\Response object
63: * @param string $unit unit used in page size, margins. Possible values include
64: * 'mm' = millimeter, "in" = inches, 'pt' = typographic points
65: *
66: * @return void
67: */
68: public function setBaseUnit($response, $unit);
69:
70: /**
71: * setMargins - set margin sizes
72: *
73: * @param Response $response \Xoops\Core\Service\Response object
74: * @param float $leftMargin left margin in base units, @see setBaseUnits()
75: * @param float $topMargin top margin in base units
76: * @param float $rightMargin right margin in base units
77: * @param float $bottomMargin bottom margin in base units
78: *
79: * @return void - response->value set to absolute URL to avatar image
80: */
81: public function setMargins($response, $leftMargin, $topMargin, $rightMargin, $bottomMargin);
82:
83: /**
84: * setBaseFont - set the base font used in rendering
85: *
86: * @param Response $response \Xoops\Core\Service\Response object
87: * @param string $fontFamily font family
88: * @param string $fontStyle font style ('bold', 'italic', etc.)
89: * @param float $fontSize font size in points
90: *
91: * @return void
92: */
93: public function setBaseFont($response, $fontFamily, $fontStyle = '', $fontSize = null);
94:
95: /**
96: * setDefaultMonospacedFont - default monotype font used in rendering
97: *
98: * @param Response $response \Xoops\Core\Service\Response object
99: * @param string $monoFontFamily font family
100: *
101: * @return void
102: */
103: public function setDefaultMonospacedFont($response, $monoFontFamily);
104:
105: /**
106: * setAuthor - set author in pdf meta data
107: *
108: * @param Response $response \Xoops\Core\Service\Response object
109: * @param string $pdfAuthor author name
110: *
111: * @return void
112: */
113: public function setAuthor($response, $pdfAuthor);
114:
115: /**
116: * setTitle - set title in pdf meta data
117: *
118: * @param Response $response \Xoops\Core\Service\Response object
119: * @param string $pdfTitle document title
120: *
121: * @return void
122: */
123: public function setTitle($response, $pdfTitle);
124:
125: /**
126: * setSubject - set subject in pdf meta data
127: *
128: * @param Response $response \Xoops\Core\Service\Response object
129: * @param string $pdfSubject document subject
130: *
131: * @return void
132: */
133: public function setSubject($response, $pdfSubject);
134:
135: /**
136: * setKeywords - set keywords in pdf meta data
137: *
138: * @param Response $response \Xoops\Core\Service\Response object
139: * @param string[] $pdfKeywords array of keywords pertaining to document
140: *
141: * @return void
142: */
143: public function setKeywords($response, $pdfKeywords);
144:
145: /**
146: * addHtml - add HTML formatted text to document. This may be called multiple times
147: *
148: * @param Response $response \Xoops\Core\Service\Response object
149: * @param string $html HTML formated text to include in document
150: * array user info, 'uid', 'uname' and 'email' required
151: *
152: * @return void
153: */
154: public function addHtml($response, $html);
155:
156: /**
157: * outputPdfInline - output a named pdf document file inline
158: *
159: * @param Response $response \Xoops\Core\Service\Response object
160: * @param string $name filename for file
161: *
162: * @return void
163: */
164: public function outputPdfInline($response, $name);
165:
166: /**
167: * outputPdfDownload - output a named pdf document file for download
168: *
169: * @param Response $response \Xoops\Core\Service\Response object
170: * @param string $name filename for file
171: *
172: * @return void
173: */
174: public function outputPdfDownload($response, $name);
175:
176: /**
177: * fetchPdf - fetch rendered document as a string
178: *
179: * @param Response $response \Xoops\Core\Service\Response object
180: *
181: * @return void - response->value set to string containing document
182: */
183: public function fetchPdf($response);
184: }
185: