| 1: | <?php |
| 2: | namespace TIC\DpdfBundle\Traits; |
| 3: | |
| 4: | use Dompdf\Dompdf; |
| 5: | use Dompdf\Css\Stylesheet; |
| 6: | use Dompdf\Frame\FrameTree; |
| 7: | use Dompdf\DOMDocument; |
| 8: | use Dompdf\DOMNode; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | trait DompdfWrapper |
| 15: | { |
| 16: | protected $dompdf; |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public function construct($options = null) |
| 24: | { |
| 25: | $this->dompdf = new Dompdf($options); |
| 26: | } |
| 27: | |
| 28: | |
| 29: | public function loadDOM($doc, $quirksmode = false) |
| 30: | { |
| 31: | $this->dompdf->loadDOM($doc, $quirksmode); |
| 32: | } |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public function loadHtmlFile($file, $encoding = null) |
| 44: | { |
| 45: | $this->dompdf->loadHtmlFile($file, $encoding); |
| 46: | } |
| 47: | |
| 48: | |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | |
| 54: | |
| 55: | public function loadHtml($str, $encoding = null) |
| 56: | { |
| 57: | $this->dompdf->loadHtml($str, $encoding); |
| 58: | } |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | public static function removeTextNodes(DOMNode $node) |
| 64: | { |
| 65: | $this->dompdf->removeTextNodes($node); |
| 66: | } |
| 67: | |
| 68: | |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | public function enableCaching($cacheId) |
| 74: | { |
| 75: | $this->dompdf->enableCaching($cacheId); |
| 76: | } |
| 77: | |
| 78: | |
| 79: | |
| 80: | |
| 81: | |
| 82: | public function parseDefaultView($value) |
| 83: | { |
| 84: | return $this->dompdf->parseDefaultView($value); |
| 85: | } |
| 86: | |
| 87: | |
| 88: | |
| 89: | |
| 90: | public function render() |
| 91: | { |
| 92: | $this->dompdf->render(); |
| 93: | } |
| 94: | |
| 95: | |
| 96: | |
| 97: | |
| 98: | |
| 99: | |
| 100: | |
| 101: | public function addInfo(string $label, string $value): void |
| 102: | { |
| 103: | $this->dompdf->addInfo($label, $value); |
| 104: | } |
| 105: | |
| 106: | |
| 107: | |
| 108: | |
| 109: | |
| 110: | |
| 111: | |
| 112: | |
| 113: | |
| 114: | |
| 115: | |
| 116: | |
| 117: | |
| 118: | |
| 119: | |
| 120: | |
| 121: | |
| 122: | public function stream($filename = "document.pdf", $options = []) |
| 123: | { |
| 124: | $this->dompdf->stream($filename, $options); |
| 125: | } |
| 126: | |
| 127: | |
| 128: | |
| 129: | |
| 130: | |
| 131: | |
| 132: | |
| 133: | |
| 134: | |
| 135: | |
| 136: | |
| 137: | |
| 138: | |
| 139: | public function output($options = []) |
| 140: | { |
| 141: | return $this->dompdf->output($options); |
| 142: | } |
| 143: | |
| 144: | |
| 145: | |
| 146: | |
| 147: | |
| 148: | |
| 149: | public function outputHtml() |
| 150: | { |
| 151: | return $this->dompdf->outputHtml(); |
| 152: | } |
| 153: | |
| 154: | |
| 155: | |
| 156: | |
| 157: | |
| 158: | |
| 159: | |
| 160: | |
| 161: | public function setPaper($size, $orientation = "portrait") |
| 162: | { |
| 163: | return $this->dompdf->setPaper($size, $orientation); |
| 164: | } |
| 165: | |
| 166: | |
| 167: | |
| 168: | |
| 169: | |
| 170: | |
| 171: | public function getPaperSize() |
| 172: | { |
| 173: | return $this->dompdf->getPaperSize(); |
| 174: | } |
| 175: | |
| 176: | |
| 177: | |
| 178: | |
| 179: | |
| 180: | |
| 181: | public function getPaperOrientation() |
| 182: | { |
| 183: | return $this->dompdf->getPaperOrientation(); |
| 184: | } |
| 185: | |
| 186: | |
| 187: | |
| 188: | |
| 189: | |
| 190: | public function setTree(FrameTree $tree) |
| 191: | { |
| 192: | return $this->dompdf->setTree($tree); |
| 193: | } |
| 194: | |
| 195: | |
| 196: | |
| 197: | |
| 198: | |
| 199: | |
| 200: | public function getTree() |
| 201: | { |
| 202: | return $this->dompdf->getTree(); |
| 203: | } |
| 204: | |
| 205: | |
| 206: | |
| 207: | |
| 208: | |
| 209: | |
| 210: | |
| 211: | |
| 212: | public function setProtocol(string $protocol) |
| 213: | { |
| 214: | return $this->dompdf->setProtocol($protocol); |
| 215: | } |
| 216: | |
| 217: | |
| 218: | |
| 219: | |
| 220: | |
| 221: | |
| 222: | public function getProtocol() |
| 223: | { |
| 224: | return $this->dompdf->getProtocol(); |
| 225: | } |
| 226: | |
| 227: | |
| 228: | |
| 229: | |
| 230: | |
| 231: | |
| 232: | |
| 233: | public function setBaseHost(string $baseHost) |
| 234: | { |
| 235: | return $this->dompdf->setBaseHost($baseHost); |
| 236: | } |
| 237: | |
| 238: | |
| 239: | |
| 240: | |
| 241: | |
| 242: | |
| 243: | public function getBaseHost() |
| 244: | { |
| 245: | return $this->dompdf->getBaseHost(); |
| 246: | } |
| 247: | |
| 248: | |
| 249: | |
| 250: | |
| 251: | |
| 252: | |
| 253: | |
| 254: | public function setBasePath(string $basePath) |
| 255: | { |
| 256: | return $this->dompdf->setBasePath($basePath); |
| 257: | } |
| 258: | |
| 259: | |
| 260: | |
| 261: | |
| 262: | |
| 263: | |
| 264: | public function getBasePath() |
| 265: | { |
| 266: | return $this->dompdf->getBasePath(); |
| 267: | } |
| 268: | |
| 269: | |
| 270: | |
| 271: | |
| 272: | |
| 273: | |
| 274: | |
| 275: | |
| 276: | public function setDefaultView($defaultView, $options) |
| 277: | { |
| 278: | return $this->dompdf->setDefaultView($defaultView, $options); |
| 279: | } |
| 280: | |
| 281: | |
| 282: | |
| 283: | |
| 284: | |
| 285: | |
| 286: | |
| 287: | public function setHttpContext($httpContext) |
| 288: | { |
| 289: | return $this->dompdf->setHttpContext($httpContext); |
| 290: | } |
| 291: | |
| 292: | |
| 293: | |
| 294: | |
| 295: | |
| 296: | |
| 297: | public function getHttpContext() |
| 298: | { |
| 299: | return $this->dompdf->getHttpContext(); |
| 300: | } |
| 301: | |
| 302: | |
| 303: | |
| 304: | |
| 305: | |
| 306: | |
| 307: | |
| 308: | |
| 309: | |
| 310: | |
| 311: | public function setCanvas(Canvas $canvas) |
| 312: | { |
| 313: | return $this->dompdf->setCanvas($canvas); |
| 314: | } |
| 315: | |
| 316: | |
| 317: | |
| 318: | |
| 319: | |
| 320: | |
| 321: | public function getCanvas() |
| 322: | { |
| 323: | return $this->dompdf->getCanvas(); |
| 324: | } |
| 325: | |
| 326: | |
| 327: | |
| 328: | |
| 329: | |
| 330: | public function setCss(Stylesheet $css) |
| 331: | { |
| 332: | return $this->dompdf->setCss($css); |
| 333: | } |
| 334: | |
| 335: | |
| 336: | |
| 337: | |
| 338: | |
| 339: | |
| 340: | public function getCss() |
| 341: | { |
| 342: | return $this->dompdf->getCss(); |
| 343: | } |
| 344: | |
| 345: | |
| 346: | |
| 347: | |
| 348: | |
| 349: | public function setDom(DOMDocument $dom) |
| 350: | { |
| 351: | return $this->dompdf->setDom($dom); |
| 352: | } |
| 353: | |
| 354: | |
| 355: | |
| 356: | |
| 357: | public function getDom() |
| 358: | { |
| 359: | return $this->dompdf->getDom(); |
| 360: | } |
| 361: | |
| 362: | |
| 363: | |
| 364: | |
| 365: | |
| 366: | public function setOptions(Options $options) |
| 367: | { |
| 368: | return $this->dompdf->setOptions($options); |
| 369: | } |
| 370: | |
| 371: | |
| 372: | |
| 373: | |
| 374: | public function getOptions() |
| 375: | { |
| 376: | return $this->dompdf->getOptions(); |
| 377: | } |
| 378: | |
| 379: | |
| 380: | |
| 381: | |
| 382: | |
| 383: | |
| 384: | public function getCallbacks() |
| 385: | { |
| 386: | return $this->dompdf->getCallbacks(); |
| 387: | } |
| 388: | |
| 389: | |
| 390: | |
| 391: | |
| 392: | |
| 393: | |
| 394: | |
| 395: | |
| 396: | |
| 397: | |
| 398: | |
| 399: | |
| 400: | |
| 401: | |
| 402: | |
| 403: | |
| 404: | |
| 405: | |
| 406: | |
| 407: | |
| 408: | |
| 409: | |
| 410: | |
| 411: | public function setCallbacks(array $callbacks): self |
| 412: | { |
| 413: | return $this->dompdf->setCallbacks($callbacks); |
| 414: | } |
| 415: | |
| 416: | |
| 417: | |
| 418: | |
| 419: | |
| 420: | |
| 421: | public function getQuirksmode() |
| 422: | { |
| 423: | return $this->dompdf->getQuirksmode(); |
| 424: | } |
| 425: | |
| 426: | |
| 427: | |
| 428: | |
| 429: | |
| 430: | public function setFontMetrics(FontMetrics $fontMetrics) |
| 431: | { |
| 432: | return $this->dompdf->setFontMetrics($fontMetrics); |
| 433: | } |
| 434: | |
| 435: | |
| 436: | |
| 437: | |
| 438: | public function getFontMetrics() |
| 439: | { |
| 440: | return $this->dompdf->getFontMetrics(); |
| 441: | } |
| 442: | |
| 443: | } |
| 444: | |