Esempio n. 1
0
        private void RenderPhoto(PhotoLayout layout, IContentContainer container)
        {
            //	Add the photo part to the document
            string imageId = _document.AddImage(layout.PhotoData.RawData);

            //	Add a new paragraph and insert into it a reference to the photo.
            //
            //	A photo is always in a paragraph of its own, and the photo
            //	style's border and padding etc. are rendered on the paragraph.
//TODO: I'm not sure that that statement about styles is correct

            s.TextStyle paraStyle = null;
            if (layout.Style != null)
            {
                s.PhotoStyle photoStyle = (s.PhotoStyle)layout.Style;
                paraStyle         = new s.TextStyle();
                paraStyle.Border  = photoStyle.Border;
                paraStyle.Padding = photoStyle.Padding;
            }
            IParagraph paragraph = container.AddParagraph(paraStyle, layout.TrackingInfo);

            paragraph.AddImage(imageId, layout.Bounds.Width, layout.Bounds.Height);
        }