/// <summary>Splits the document basing on the given size.</summary>
        /// <param name="size"><strog>Preferred</strog> size for splitting.</param>
        /// <returns>
        /// The documents which the source document was split into.
        /// Be warned that these documents are not closed.
        /// </returns>
        public virtual IList <PdfDocument> SplitBySize(long size)
        {
            IList <PageRange> splitRanges = new List <PageRange>();
            int currentPage = 1;
            int numOfPages  = pdfDocument.GetNumberOfPages();

            while (currentPage <= numOfPages)
            {
                PageRange nextRange = GetNextRange(currentPage, numOfPages, size);
                splitRanges.Add(nextRange);
                IList <int> allPages = nextRange.GetAllPages();
                currentPage = (int)allPages[allPages.Count - 1] + 1;
            }
            return(ExtractPageRanges(splitRanges));
        }