private static byte[] LoadPage(TilesManager tileManager, int page, double scale)
        {
            var internalPage = page;

            if (page > 0)
            {
                internalPage = page - 1;
            }

            int pageWidth = 0, pageHeight = 0;

            tileManager.LoadPage(internalPage, ref pageWidth, ref pageHeight, false);
            var tile = new Tile
            {
                PageNum = internalPage,
                Height  = (int)(pageHeight * scale),
                Width   = (int)(pageWidth * scale),
                Scale   = scale
            };
            var result = tileManager.GetPageInBytes(tile, false);

            return(result);
        }
示例#2
0
        private IEnumerable <byte[]> LoadPages(Stream xpsStream)
        {
            var result = new List <byte[]>();

            using (var tileManager = new TilesManager(xpsStream))
            {
                for (var i = 0; i < tileManager.PageCount; i++)
                {
                    int pageWidth = 0, pageHeight = 0;
                    tileManager.LoadPage(i, ref pageWidth, ref pageHeight, false);
                    var tile = new Tile
                    {
                        PageNum = i,
                        Height  = pageHeight,
                        Width   = pageWidth,
                        Scale   = 1.0
                    };
                    var page = tileManager.GetPageInBytes(tile, false);
                    result.Add(page);
                }
            }
            return(result);
        }