PluginProbe
PostNL for WooCommerce / 5.9.12
PostNL for WooCommerce v5.9.12
5.9.12 5.9.11 5.9.10 5.9.9 5.9.8 5.9.7 5.9.6 trunk 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.1.4 3.1.5 3.1.6 3.1.7 4.0.0 4.0.1 4.0.2 4.3.2 4.3.3 4.4.0 4.4.1 All 72 releases
woo-postnl / src / Library / PDF_Rotate.php

PDF_Rotate.php in PostNL for WooCommerce 5.9.12, at src/Library/PDF_Rotate.php

49 lines 894 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class PDF_Rotate file.
4 *
5 * @package PostNLWooCommerce\Library
6 */
7
8
9 namespace PostNLWooCommerce\Library;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 use setasign\Fpdi\Fpdi;
16
17 class PDF_Rotate extends FPDI {
18 var $angle = 0;
19
20 function Rotate( $angle, $x = - 1, $y = - 1 ) {
21 if ( $x == - 1 ) {
22 $x = $this->x;
23 }
24 if ( $y == - 1 ) {
25 $y = $this->y;
26 }
27 if ( $this->angle != 0 ) {
28 $this->_out( 'Q' );
29 }
30 $this->angle = $angle;
31 if ( $angle != 0 ) {
32 $angle *= M_PI / 180;
33 $c = cos( $angle );
34 $s = sin( $angle );
35 $cx = $x * $this->k;
36 $cy = ( $this->h - $y ) * $this->k;
37 $this->_out( sprintf( 'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', $c, $s, - $s, $c, $cx, $cy, - $cx, - $cy ) );
38 }
39 }
40
41 function _endpage() {
42 if ( $this->angle != 0 ) {
43 $this->angle = 0;
44 $this->_out( 'Q' );
45 }
46 parent::_endpage();
47 }
48 }
49