Пример #1
0
        public List <SizeF> GetPageSizes(bool isActualSize)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(GetType().Name);
            }

            int pageCount = PdfiumLibrary.FPDF_GetPageCount(_document);
            var pageSizes = new List <SizeF>(pageCount);

            for (int i = 0; i < pageCount; i++)
            {
                var rotate = GetPageRotation(i);
                if (rotate != RotateType.Rotate0 && isActualSize)
                {
                    SetPageRotation(i, (int)RotateType.Rotate0);
                }

                bool result = GetPageCropBox(i, out float left, out float bottom, out float right, out float top);
                if (result && isActualSize)
                {
                    SetPageCropBox(i, 0, 0, 0, 0);
                }

                pageSizes.Add(GetPageSize(i));

                if (rotate != RotateType.Rotate0 && isActualSize)
                {
                    SetPageRotation(i, (int)rotate);
                }

                if (result && isActualSize)
                {
                    SetPageCropBox(i, left, bottom, right, top);
                }
            }

            return(pageSizes);
        }