Beispiel #1
0
        private bool AppendToPage(ImageTokenBlock block)
        {
            BookImage bookImage = _images.FirstOrDefault(t => t.ID == block.ImageID);
            if (bookImage == null)
                return true;

            Size size = bookImage.FitToSize(_pageSize);
            if (_height + size.Height <= _pageSize.Height)
            {
                _height += size.Height;
                if (_page.FirstTokenID < 0)
                    _page.FirstTokenID = block.FirstTokenID;

                _page.LastTokenID = block.LastTokenID;
                _page.LastTextPart = block.GetLastPart();
                AddImageParagraph(block, size);
                return true;
            }
            return false;
        }
Beispiel #2
0
 private void AddImageParagraph(ImageTokenBlock block, Size size)
 {
     var paragraphInfo = new ImageParagraphInfo();
     paragraphInfo.Inlines.Add(new ImageElement
                               {
                                   ImageID = block.ImageID,
                                   Width = (int) size.Width,
                                   Height = (int) size.Height
                               });
     _page.Paragraphs.Add(paragraphInfo);
     _page.Lines.Add(block);
 }
Beispiel #3
0
 private void AppendToLine(PictureToken token)
 {
     var imageTokenBlock = new ImageTokenBlock
                               {
                                   ImageID = token.ImageID,
                                   FirstTokenID = _firstTokenID,
                                   LastTokenID = token.ID
                               };
     _output.Enqueue(imageTokenBlock);
     _firstTokenID = token.ID + 1;
 }