Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  /**
   3   * This file is part of FPDI
   4   *
   5   * @package   setasign\Fpdi
   6   * @copyright Copyright (c) 2019 Setasign - Jan Slabon (https://www.setasign.com)
   7   * @license   http://opensource.org/licenses/mit-license The MIT License
   8   */
   9  
  10  namespace setasign\Fpdi\PdfReader;
  11  
  12  /**
  13   * An abstract class for page boundary constants and some helper methods
  14   *
  15   * @package setasign\Fpdi\PdfReader
  16   */
  17  abstract class PageBoundaries
  18  {
  19      /**
  20       * MediaBox
  21       *
  22       * The media box defines the boundaries of the physical medium on which the page is to be printed.
  23       *
  24       * @see PDF 32000-1:2008 - 14.11.2 Page Boundaries
  25       * @var string
  26       */
  27      const MEDIA_BOX = 'MediaBox';
  28  
  29      /**
  30       * CropBox
  31       *
  32       * The crop box defines the region to which the contents of the page shall be clipped (cropped) when displayed or
  33       * printed.
  34       *
  35       * @see PDF 32000-1:2008 - 14.11.2 Page Boundaries
  36       * @var string
  37       */
  38      const CROP_BOX = 'CropBox';
  39  
  40      /**
  41       * BleedBox
  42       *
  43       * The bleed box defines the region to which the contents of the page shall be clipped when output in a
  44       * production environment.
  45       *
  46       * @see PDF 32000-1:2008 - 14.11.2 Page Boundaries
  47       * @var string
  48       */
  49      const BLEED_BOX = 'BleedBox';
  50  
  51      /**
  52       * TrimBox
  53       *
  54       * The trim box defines the intended dimensions of the finished page after trimming.
  55       *
  56       * @see PDF 32000-1:2008 - 14.11.2 Page Boundaries
  57       * @var string
  58       */
  59      const TRIM_BOX = 'TrimBox';
  60  
  61      /**
  62       * ArtBox
  63       *
  64       * The art box defines the extent of the page’s meaningful content (including potential white space) as intended
  65       * by the page’s creator.
  66       *
  67       * @see PDF 32000-1:2008 - 14.11.2 Page Boundaries
  68       * @var string
  69       */
  70      const ART_BOX = 'ArtBox';
  71  
  72      /**
  73       * All page boundaries
  74       *
  75       * @var array
  76       */
  77      public static $all = array(
  78          self::MEDIA_BOX,
  79          self::CROP_BOX,
  80          self::BLEED_BOX,
  81          self::TRIM_BOX,
  82          self::ART_BOX
  83      );
  84  
  85      /**
  86       * Checks if a name is a valid page boundary name.
  87       *
  88       * @param string $name The boundary name
  89       * @return boolean A boolean value whether the name is valid or not.
  90       */
  91      public static function isValidName($name)
  92      {
  93          return \in_array($name, self::$all, true);
  94      }
  95  }