/// <summary>
        /// Value-setting constructor.
        /// </summary>
        /// <param name="parent">The parent node of this page in the document page tree.</param>
        /// <param name="objectId">The indirect object ID of this page.</param>
        /// <param name="size">The paper size of this page.</param>
        /// <param name="orientation">The orientation of this page.</param>
        /// <param name="horizontalMarginProportion">The proportion of the page taken up by each of the left and right margins.</param>
        /// <param name="verticalMarginProportion">The proportion of the page taken up by each of the top and bottom margins.</param>
        /// <param name="generation">The object generation number.  Defaults to zero.  As we do not currently support rewriting existing documents, this should not be set.</param>
        public PdfPage(
            PdfPageTreeNode parent,
            int objectId,
            PhysicalPageSize size,
            PageOrientation orientation,
            double horizontalMarginProportion,
            double verticalMarginProportion,
            int generation = 0)
            : base(parent, objectId, generation)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            PageSize        = size;
            PageOrientation = orientation;

            UniSize pagePtSize = size.ToUniSize(orientation);

            TopMarginPosition     = pagePtSize.Height * verticalMarginProportion;
            BottomMarginPosition  = pagePtSize.Height - TopMarginPosition;
            LeftMarginPosition    = pagePtSize.Width * horizontalMarginProportion;
            RightMarginPosition   = pagePtSize.Width - LeftMarginPosition;
            PageAvailableWidth    = RightMarginPosition - LeftMarginPosition;
            CurrentVerticalCursor = TopMarginPosition;
            MediaBox = size.ToPdfRectangle(orientation);
        }
Пример #2
0
 /// <summary>
 /// Value-setting constructor.
 /// </summary>
 /// <param name="parent">The parent of this item.  Can be null if this item is the root node of the tree.</param>
 /// <param name="objectId">The indirect object ID of this item.</param>
 /// <param name="generation">The generation number of this item.  Defaults to zero.  As the library does not currently support rewriting existing files, this parameter should not be set.</param>
 protected PdfPageTreeItem(PdfPageTreeNode parent, int objectId, int generation = 0) : base(objectId, generation)
 {
     Parent = parent;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="pageRoot">The document page tree root node.</param>
 /// <param name="objectId">The indirect object ID of the catalogue.</param>
 /// <param name="generation">The generation number of the catalogue.  This defaults to zero and can effectively be ignored when creating a new document.</param>
 /// <exception cref="ArgumentNullException">Thrown if the pageRoot parameter is null.</exception>
 public PdfCatalogue(PdfPageTreeNode pageRoot, int objectId, int generation = 0) : base(objectId, generation)
 {
     PageRoot = pageRoot ?? throw new ArgumentNullException(nameof(pageRoot));
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="parent">The parent node of this node (null if this is the root of the page tree).</param>
 /// <param name="objectId">The indirect object ID of the node.</param>
 /// <param name="generation">The generation number of this object.  Defaults to 0.  As the library does not support rewriting existing files, should not be set.</param>
 public PdfPageTreeNode(PdfPageTreeNode parent, int objectId, int generation = 0) : base(parent, objectId, generation)
 {
     Kids = new List <PdfPageTreeItem>();
 }