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); }
private double GetImageHeight(string imageID) { BookImage bookImage = _images.FirstOrDefault(t => t.ID == imageID); if (bookImage == null) { return(0.0); } return(bookImage.FitToSize(_pageSize).Height); }