Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

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