From a2ec62a79fb2e9ef51aa021ac84c174231d65e5a Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Fri, 6 Jun 2014 15:23:19 +0700 Subject: [PATCH] Section: Ability to set paper size, e.g. A4, A3, and Legal --- CHANGELOG.md | 1 + composer.lock | 219 +++++++++------------- samples/Sample_03_Sections.php | 4 +- src/PhpWord/Style/Paper.php | 188 +++++++++++++++++++ src/PhpWord/Style/Section.php | 47 ++++- src/PhpWord/Writer/RTF/Style/Border.php | 2 - tests/PhpWord/Tests/Style/SectionTest.php | 16 +- 7 files changed, 328 insertions(+), 149 deletions(-) create mode 100644 src/PhpWord/Style/Paper.php diff --git a/CHANGELOG.md b/CHANGELOG.md index f176fa44..eb0a6c20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ This is the changelog between releases of PHPWord. Releases are listed in revers - Font: New `scale`, `spacing`, and `kerning` property of font style - @ivanlanin - Paragraph: Added shading to the paragraph style for full width shading - @lrobert GH-264 - RTF Writer: Support for sections, margins, and borders - @ivanlanin GH-249 +- Section: Ability to set paper size, e.g. A4, A3, and Legal - @ivanlanin GH-249 ### Bugfixes diff --git a/composer.lock b/composer.lock index 172e564e..11a38043 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "91993ff980d11a416fcf3a7309a4044f", + "hash": "7d0a883164ca8e64ca34f4910aa64b96", "packages": [ ], @@ -553,16 +553,16 @@ }, { "name": "monolog/monolog", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "65026b610f8c19e61d7242f600530677b0466aac" + "reference": "25b16e801979098cb2f120e697bfce454b18bf23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/65026b610f8c19e61d7242f600530677b0466aac", - "reference": "65026b610f8c19e61d7242f600530677b0466aac", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/25b16e801979098cb2f120e697bfce454b18bf23", + "reference": "25b16e801979098cb2f120e697bfce454b18bf23", "shasum": "" }, "require": { @@ -590,7 +590,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -617,7 +617,7 @@ "logging", "psr-3" ], - "time": "2014-04-24 13:29:03" + "time": "2014-06-04 16:30:04" }, { "name": "mpdf/mpdf", @@ -1984,17 +1984,17 @@ }, { "name": "symfony/config", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Config", "source": { "type": "git", "url": "https://github.com/symfony/Config.git", - "reference": "2effc67af6f21a0d267210b72d0b0b691d113528" + "reference": "9c8caadb38ecc69ac35ab31af4d1996944b5a09f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Config/zipball/2effc67af6f21a0d267210b72d0b0b691d113528", - "reference": "2effc67af6f21a0d267210b72d0b0b691d113528", + "url": "https://api.github.com/repos/symfony/Config/zipball/9c8caadb38ecc69ac35ab31af4d1996944b5a09f", + "reference": "9c8caadb38ecc69ac35ab31af4d1996944b5a09f", "shasum": "" }, "require": { @@ -2004,7 +2004,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2030,36 +2030,38 @@ ], "description": "Symfony Config Component", "homepage": "http://symfony.com", - "time": "2014-04-22 08:11:06" + "time": "2014-04-22 08:11:23" }, { "name": "symfony/console", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Console", "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "2e452005b1e1d003d23702d227e23614679eb5ca" + "reference": "ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/2e452005b1e1d003d23702d227e23614679eb5ca", - "reference": "2e452005b1e1d003d23702d227e23614679eb5ca", + "url": "https://api.github.com/repos/symfony/Console/zipball/ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c", + "reference": "ef4ca73b0b3a10cbac653d3ca482d0cdd4502b2c", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { + "psr/log": "~1.0", "symfony/event-dispatcher": "~2.1" }, "suggest": { + "psr/log": "For using the console logger", "symfony/event-dispatcher": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2085,28 +2087,31 @@ ], "description": "Symfony Console Component", "homepage": "http://symfony.com", - "time": "2014-04-27 13:34:57" + "time": "2014-05-22 08:54:24" }, { "name": "symfony/event-dispatcher", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "e539602e5455aa086c0e81e604745af7789e4d8a" + "reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/e539602e5455aa086c0e81e604745af7789e4d8a", - "reference": "e539602e5455aa086c0e81e604745af7789e4d8a", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8", + "reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/dependency-injection": "~2.0" + "psr/log": "~1.0", + "symfony/config": "~2.0", + "symfony/dependency-injection": "~2.0", + "symfony/stopwatch": "~2.2" }, "suggest": { "symfony/dependency-injection": "", @@ -2115,7 +2120,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2141,21 +2146,21 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", - "time": "2014-04-16 10:34:31" + "time": "2014-04-29 10:13:57" }, { "name": "symfony/filesystem", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Filesystem", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "a3af8294bcce4a7c1b2892363b0c9d8109affad4" + "reference": "98e831eac836a0a5911626ce82684155f21d0e4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/a3af8294bcce4a7c1b2892363b0c9d8109affad4", - "reference": "a3af8294bcce4a7c1b2892363b0c9d8109affad4", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/98e831eac836a0a5911626ce82684155f21d0e4d", + "reference": "98e831eac836a0a5911626ce82684155f21d0e4d", "shasum": "" }, "require": { @@ -2164,7 +2169,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2190,21 +2195,21 @@ ], "description": "Symfony Filesystem Component", "homepage": "http://symfony.com", - "time": "2014-04-16 10:34:31" + "time": "2014-04-16 10:36:21" }, { "name": "symfony/finder", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "25e1e7d5e7376f8a92ae3b1d714d956edf33a730" + "reference": "307aad2c541bbdf43183043645e186ef2cd6b973" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/25e1e7d5e7376f8a92ae3b1d714d956edf33a730", - "reference": "25e1e7d5e7376f8a92ae3b1d714d956edf33a730", + "url": "https://api.github.com/repos/symfony/Finder/zipball/307aad2c541bbdf43183043645e186ef2cd6b973", + "reference": "307aad2c541bbdf43183043645e186ef2cd6b973", "shasum": "" }, "require": { @@ -2213,7 +2218,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2239,21 +2244,21 @@ ], "description": "Symfony Finder Component", "homepage": "http://symfony.com", - "time": "2014-04-27 13:34:57" + "time": "2014-05-22 13:47:45" }, { "name": "symfony/process", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "8721f1476d5d38a43c7d6ccb6435b351cf8f3bb7" + "reference": "5d7d78e23894544740219e006320678cfa4cd45b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/8721f1476d5d38a43c7d6ccb6435b351cf8f3bb7", - "reference": "8721f1476d5d38a43c7d6ccb6435b351cf8f3bb7", + "url": "https://api.github.com/repos/symfony/Process/zipball/5d7d78e23894544740219e006320678cfa4cd45b", + "reference": "5d7d78e23894544740219e006320678cfa4cd45b", "shasum": "" }, "require": { @@ -2262,7 +2267,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2288,81 +2293,21 @@ ], "description": "Symfony Process Component", "homepage": "http://symfony.com", - "time": "2014-04-27 13:34:57" - }, - { - "name": "symfony/property-access", - "version": "v2.4.4", - "target-dir": "Symfony/Component/PropertyAccess", - "source": { - "type": "git", - "url": "https://github.com/symfony/PropertyAccess.git", - "reference": "0456222bc00c40c1365065b603f7c397fb9a7134" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/PropertyAccess/zipball/0456222bc00c40c1365065b603f7c397fb9a7134", - "reference": "0456222bc00c40c1365065b603f7c397fb9a7134", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\PropertyAccess\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony PropertyAccess Component", - "homepage": "http://symfony.com", - "keywords": [ - "access", - "array", - "extraction", - "index", - "injection", - "object", - "property", - "property path", - "reflection" - ], - "time": "2014-04-18 20:37:09" + "time": "2014-05-23 09:02:52" }, { "name": "symfony/stopwatch", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Stopwatch", "source": { "type": "git", "url": "https://github.com/symfony/Stopwatch.git", - "reference": "343bcc0360f2c22f371884b8f6a9fee8d1aa431a" + "reference": "724d73604ebe6c1c9bdf36533b556123bd9075a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/343bcc0360f2c22f371884b8f6a9fee8d1aa431a", - "reference": "343bcc0360f2c22f371884b8f6a9fee8d1aa431a", + "url": "https://api.github.com/repos/symfony/Stopwatch/zipball/724d73604ebe6c1c9bdf36533b556123bd9075a1", + "reference": "724d73604ebe6c1c9bdf36533b556123bd9075a1", "shasum": "" }, "require": { @@ -2371,7 +2316,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2397,21 +2342,21 @@ ], "description": "Symfony Stopwatch Component", "homepage": "http://symfony.com", - "time": "2014-04-18 20:37:09" + "time": "2014-04-18 20:40:13" }, { "name": "symfony/translation", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Translation", "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "d2c73ffa4a5ba1fa0c5d93f43b68331dffe898c5" + "reference": "5f23265dcf8927a84be832608069c9edca3cf5f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/d2c73ffa4a5ba1fa0c5d93f43b68331dffe898c5", - "reference": "d2c73ffa4a5ba1fa0c5d93f43b68331dffe898c5", + "url": "https://api.github.com/repos/symfony/Translation/zipball/5f23265dcf8927a84be832608069c9edca3cf5f4", + "reference": "5f23265dcf8927a84be832608069c9edca3cf5f4", "shasum": "" }, "require": { @@ -2428,7 +2373,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2454,48 +2399,53 @@ ], "description": "Symfony Translation Component", "homepage": "http://symfony.com", - "time": "2014-04-18 21:02:05" + "time": "2014-05-22 13:47:45" }, { "name": "symfony/validator", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Validator", "source": { "type": "git", "url": "https://github.com/symfony/Validator.git", - "reference": "5bbcdcc520bc7fb3826abb44020880f14c9c03a7" + "reference": "62f6f7735fbd3897b9347ae60fda4a40d0122640" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Validator/zipball/5bbcdcc520bc7fb3826abb44020880f14c9c03a7", - "reference": "5bbcdcc520bc7fb3826abb44020880f14c9c03a7", + "url": "https://api.github.com/repos/symfony/Validator/zipball/62f6f7735fbd3897b9347ae60fda4a40d0122640", + "reference": "62f6f7735fbd3897b9347ae60fda4a40d0122640", "shasum": "" }, "require": { "php": ">=5.3.3", - "symfony/property-access": "~2.2", "symfony/translation": "~2.0" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", + "egulias/email-validator": "~1.0", "symfony/config": "~2.2", + "symfony/expression-language": "~2.4", "symfony/http-foundation": "~2.1", "symfony/intl": "~2.3", + "symfony/property-access": "~2.2", "symfony/yaml": "~2.0" }, "suggest": { "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader", + "doctrine/cache": "For using the default cached annotation reader and metadata cache.", + "egulias/email-validator": "Strict (RFC compliant) email validation", "symfony/config": "", + "symfony/expression-language": "For using the 2.4 Expression validator", "symfony/http-foundation": "", "symfony/intl": "", + "symfony/property-access": "For using the 2.4 Validator API", "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2521,21 +2471,21 @@ ], "description": "Symfony Validator Component", "homepage": "http://symfony.com", - "time": "2014-04-27 13:34:57" + "time": "2014-05-31 02:02:56" }, { "name": "symfony/yaml", - "version": "v2.4.4", + "version": "v2.5.0", "target-dir": "Symfony/Component/Yaml", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "65539ecde838f9c0d18b006b2101e3deb4b5c9ff" + "reference": "b4b09c68ec2f2727574544ef0173684281a5033c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/65539ecde838f9c0d18b006b2101e3deb4b5c9ff", - "reference": "65539ecde838f9c0d18b006b2101e3deb4b5c9ff", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/b4b09c68ec2f2727574544ef0173684281a5033c", + "reference": "b4b09c68ec2f2727574544ef0173684281a5033c", "shasum": "" }, "require": { @@ -2544,7 +2494,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -2570,15 +2520,15 @@ ], "description": "Symfony Yaml Component", "homepage": "http://symfony.com", - "time": "2014-04-18 20:37:09" + "time": "2014-05-16 14:25:18" }, { "name": "tecnick.com/tcpdf", - "version": "6.0.078", + "version": "6.0.083", "source": { "type": "git", "url": "git://git.code.sf.net/p/tcpdf/code", - "reference": "e1cbda79b99f3cdc8fdf26b39eb4870d2cd9fbac" + "reference": "d6a2206ab366f493680a22151429f17fd045fe04" }, "require": { "php": ">=5.3.0" @@ -2627,7 +2577,7 @@ "pdf417", "qrcode" ], - "time": "2014-05-12 19:50:13" + "time": "2014-05-29 18:28:56" }, { "name": "twig/twig", @@ -3274,8 +3224,7 @@ ], "platform": { "php": ">=5.3.3", - "ext-xml": "*", - "ext-zip": "*" + "ext-xml": "*" }, "platform-dev": [ diff --git a/samples/Sample_03_Sections.php b/samples/Sample_03_Sections.php index bfbc84af..9ed75c73 100644 --- a/samples/Sample_03_Sections.php +++ b/samples/Sample_03_Sections.php @@ -16,8 +16,8 @@ $section->addPageBreak(); $section->addPageBreak(); // New portrait section -$section = $phpWord->addSection(array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)); -$section->addText('This section uses other margins.'); +$section = $phpWord->addSection(array('paperSize' => 'Folio', 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)); +$section->addText('This section uses other margins with folio papersize.'); // New portrait section with Header & Footer $section = $phpWord->addSection(array('marginLeft' => 200, 'marginRight' => 200, 'marginTop' => 200, 'marginBottom' => 200, 'headerHeight' => 50, 'footerHeight' => 50,)); diff --git a/src/PhpWord/Style/Paper.php b/src/PhpWord/Style/Paper.php new file mode 100644 index 00000000..642666b5 --- /dev/null +++ b/src/PhpWord/Style/Paper.php @@ -0,0 +1,188 @@ + array(297, 420, 'mm'), + 'A4' => array(210, 297, 'mm'), + 'A5' => array(148, 210, 'mm'), + 'Folio' => array(8.5, 13, 'in'), + 'Legal' => array(8.5, 14, 'in'), + 'Letter' => array(8.5, 11, 'in'), + ); + + /** + * Paper size + * + * @var string + */ + private $size = 'A4'; + + /** + * Width + * + * @var int (twip) + */ + private $width; + + /** + * Height + * + * @var int (twip) + */ + private $height; + + /** + * Create a new instance + * + * @param string $size + */ + public function __construct($size = 'A4') + { + $this->setSize($size); + } + + /** + * Get size + * + * @return string + */ + public function getSize() + { + return $this->size; + } + + /** + * Set size + * + * @param string $size + * @return self + */ + public function setSize($size) + { + $this->size = $this->setEnumVal($size, array_keys($this->sizes), $this->size); + + list($width, $height, $unit) = $this->sizes[$this->size]; + $multipliers = array('mm' => 56.5217, 'in' => 1440); + $multiplier = $multipliers[$unit]; + + $this->width = (int)round($width * $multiplier); + $this->height = (int)round($height * $multiplier); + + return $this; + } + + /** + * Get width + * + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Get height + * + * @return int + */ + public function getHeight() + { + return $this->height; + } +} diff --git a/src/PhpWord/Style/Section.php b/src/PhpWord/Style/Section.php index fd59f1b4..c56b0a19 100644 --- a/src/PhpWord/Style/Section.php +++ b/src/PhpWord/Style/Section.php @@ -35,8 +35,8 @@ class Section extends Border * * @const int|float */ - const DEFAULT_WIDTH = 11906; // In twip - const DEFAULT_HEIGHT = 16838; // In twip + const DEFAULT_WIDTH = 11870; // In twip + const DEFAULT_HEIGHT = 16787; // In twip const DEFAULT_MARGIN = 1440; // In twip const DEFAULT_GUTTER = 0; // In twip const DEFAULT_HEADER_HEIGHT = 720; // In twip @@ -52,6 +52,13 @@ class Section extends Border */ private $orientation = self::ORIENTATION_PORTRAIT; + /** + * Paper size + * + * @var \PhpOffice\PhpWord\Style\Paper + */ + private $paper; + /** * Page Size Width * @@ -159,6 +166,42 @@ class Section extends Border */ private $lineNumbering; + /** + * Create new instance + */ + public function __construct() + { + $this->setPaperSize(); + } + + /** + * Get paper size + * + * @return string + */ + public function getPaperSize() + { + return $this->paper->getSize(); + } + + /** + * Set paper size + * + * @param string $value + * @return self + */ + public function setPaperSize($value = 'A4') + { + if ($this->paper === null) { + $this->paper = new Paper(); + } + $this->paper->setSize($value); + $this->pageSizeW = $this->paper->getWidth(); + $this->pageSizeH = $this->paper->getHeight(); + + return $this; + } + /** * Set Setting Value * diff --git a/src/PhpWord/Writer/RTF/Style/Border.php b/src/PhpWord/Writer/RTF/Style/Border.php index 8df6d165..8bb9703f 100644 --- a/src/PhpWord/Writer/RTF/Style/Border.php +++ b/src/PhpWord/Writer/RTF/Style/Border.php @@ -17,8 +17,6 @@ namespace PhpOffice\PhpWord\Writer\RTF\Style; -use PhpOffice\PhpWord\Shared\XMLWriter; - /** * Border style writer * diff --git a/tests/PhpWord/Tests/Style/SectionTest.php b/tests/PhpWord/Tests/Style/SectionTest.php index dd7273cb..de582948 100644 --- a/tests/PhpWord/Tests/Style/SectionTest.php +++ b/tests/PhpWord/Tests/Style/SectionTest.php @@ -35,13 +35,13 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings = new Section(); $this->assertEquals('portrait', $oSettings->getOrientation()); - $this->assertEquals(11906, $oSettings->getPageSizeW()); - $this->assertEquals(16838, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW()); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH()); $oSettings->setSettingValue('orientation', 'landscape'); $this->assertEquals('landscape', $oSettings->getOrientation()); - $this->assertEquals(16838, $oSettings->getPageSizeW()); - $this->assertEquals(11906, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeW()); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeH()); $iVal = rand(1, 1000); $oSettings->setSettingValue('borderSize', $iVal); @@ -106,8 +106,8 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings->setLandscape(); $this->assertEquals('landscape', $oSettings->getOrientation()); - $this->assertEquals(16838, $oSettings->getPageSizeW()); - $this->assertEquals(11906, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeW()); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeH()); } /** @@ -120,8 +120,8 @@ class SettingsTest extends \PHPUnit_Framework_TestCase $oSettings->setPortrait(); $this->assertEquals('portrait', $oSettings->getOrientation()); - $this->assertEquals(11906, $oSettings->getPageSizeW()); - $this->assertEquals(16838, $oSettings->getPageSizeH()); + $this->assertEquals(Section::DEFAULT_WIDTH, $oSettings->getPageSizeW()); + $this->assertEquals(Section::DEFAULT_HEIGHT, $oSettings->getPageSizeH()); } /**