Example #1
0
    /// <summary>
    /// Change unit of the size and recalculate height and width
    /// </summary>
    /// <param name="unit">New unit</param>
    public PdfSize ChangeUnits(PdfUnit unit)
    {
      var ratio = Unit.Points / unit.Points;
      var result = new PdfSize(unit, Height * ratio, Width * ratio);

      return result;
    }
Example #2
0
        /// <summary>
        /// Change unit of the size and recalculate height and width
        /// </summary>
        /// <param name="unit">New unit</param>
        public PdfSize ChangeUnits(PdfUnit unit)
        {
            var ratio  = Unit.Points / unit.Points;
            var result = new PdfSize(unit, Height * ratio, Width * ratio);

            return(result);
        }
Example #3
0
        /// <summary>
        /// Creates new page and adds it to the page tree
        /// </summary>
        /// <returns></returns>
        public PdfPage CreatePage(PdfSize size)
        {
            var page = new PdfPage(this, size);
              m_Pages.Add(page);

              return page;
        }
Example #4
0
 public bool Equals(PdfSize other)
 {
   if (other == null) return false;
   return Math.Abs(this.Height - other.Height) < double.Epsilon &&
          Math.Abs(this.Width - other.Width) < double.Epsilon &&
          this.Unit == null ? (other.Unit == null) : this.Unit.Equals(other.Unit); 
 }
Example #5
0
 internal PdfPage(PdfPageTree parent, PdfSize size)
 {
     m_Size = size;
       m_Unit = m_Size.Unit;
       m_Parent = parent;
       m_Fonts = new List<PdfFont>();
       m_Elements = new List<PdfElement>();
 }
Example #6
0
 public bool Equals(PdfSize other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Math.Abs(this.Height - other.Height) < double.Epsilon &&
            Math.Abs(this.Width - other.Width) < double.Epsilon &&
            ((this.Unit == null) ? (other.Unit == null) : this.Unit.Equals(other.Unit)));
 }
Example #7
0
        public PdfDocument()
        {
            m_Fonts = new List<PdfFont>();
              m_Meta = new PdfMeta();
              m_Info = new PdfInfo();
              m_OutLines = new PdfOutlines();
              m_Root = new PdfRoot();
              m_PageTree = new PdfPageTree();
              m_Trailer = new PdfTrailer();
              m_ObjectRepository = new ObjectRepository();
              m_ResourceRepository = new ResourceRepository();

              m_Root.Info = m_Info;
              m_Root.Outlines = m_OutLines;
              m_Root.PageTree = m_PageTree;
              m_Trailer.Root = m_Root;

              m_PageSize = PdfPageSize.Default();
        }
Example #8
0
 /// <summary>
 /// Adds new page to document
 /// </summary>
 /// <returns>Page</returns>
 public PdfPage AddPage(PdfSize size = null)
 {
     size = size ?? PageSize ?? PdfPageSize.Default();
       return m_PageTree.CreatePage(size);
 }