github.com/unidoc/unidoc@v2.2.0+incompatible/pdf/creator/const.go (about)

     1  /*
     2   * This file is subject to the terms and conditions defined in
     3   * file 'LICENSE.md', which is part of this source code package.
     4   */
     5  
     6  package creator
     7  
     8  // PageSize represents the page size as a 2 element array representing the width and height in PDF document units (points).
     9  type PageSize [2]float64
    10  
    11  // PPI specifies the default PDF resolution in points/inch.
    12  var PPI float64 = 72 // Points per inch. (Default resolution).
    13  
    14  // PPMM specifies the default PDF resolution in points/mm.
    15  var PPMM float64 = 72 * 1.0 / 25.4 // Points per mm. (Default resolution).
    16  
    17  //
    18  // Commonly used page sizes
    19  //
    20  var (
    21  	PageSizeA3     = PageSize{297 * PPMM, 420 * PPMM}
    22  	PageSizeA4     = PageSize{210 * PPMM, 297 * PPMM}
    23  	PageSizeA5     = PageSize{148 * PPMM, 210 * PPMM}
    24  	PageSizeLetter = PageSize{8.5 * PPI, 11 * PPI}
    25  	PageSizeLegal  = PageSize{8.5 * PPI, 14 * PPI}
    26  )
    27  
    28  // TextAlignment options for paragraph.
    29  type TextAlignment int
    30  
    31  // The options supported for text alignment are:
    32  // left - TextAlignmentLeft
    33  // right - TextAlignmentRight
    34  // center - TextAlignmentCenter
    35  // justify - TextAlignmentJustify
    36  const (
    37  	TextAlignmentLeft TextAlignment = iota
    38  	TextAlignmentRight
    39  	TextAlignmentCenter
    40  	TextAlignmentJustify
    41  )
    42  
    43  // Relative and absolute positioning types.
    44  type positioning int
    45  
    46  const (
    47  	positionRelative positioning = iota
    48  	positionAbsolute
    49  )
    50  
    51  func (p positioning) isRelative() bool {
    52  	return p == positionRelative
    53  }
    54  func (p positioning) isAbsolute() bool {
    55  	return p == positionAbsolute
    56  }