Ejemplo n.º 1
0
        private void backgroundSources()
        {
            Paragraph p = new Paragraph();

            p.Add("Discussion sources:");
            document.Add(p);
            foreach (Attachment at in discussion.Attachment)
            {
                BitmapSource          src        = MiniAttachmentManager.GetAttachmentBitmap2(at);
                System.Drawing.Image  drawingImg = BitmapSourceToBitmap(src);
                iTextSharp.text.Image itextImg   = iTextSharp.text.Image.GetInstance(drawingImg, BaseColor.WHITE);
                itextImg.ScaleToFit(150, 200);
                document.Add(itextImg);

                switch ((AttachmentFormat)at.Format)
                {
                case AttachmentFormat.Pdf:
                    break;

                case AttachmentFormat.Bmp:
                case AttachmentFormat.Jpg:
                case AttachmentFormat.Png:
                    break;

                case AttachmentFormat.Youtube:
                    p = new Paragraph();
                    p.Add("Youtube: " + at.VideoLinkURL);
                    document.Add(p);
                    break;

                default:
                    throw new NotSupportedException();
                }
            }
        }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            return(MiniAttachmentManager.GetAttachmentBitmap2(value as Attachment));
        }
Ejemplo n.º 3
0
        private PdfPTable addArgPoint(ArgPoint pt)
        {
            PdfPTable aTable = new PdfPTable(3);

            BaseColor clr = DiscussionColors.GetSideColor(pt.SideCode);

            PdfPCell c = getColoredTxtCell("Point:  " + string.Format("{0}", pt.Point) + "\n" +
                                           "Description:  " + string.Format("{0}", pt.Point) + "\n" +
                                           "Author(Name/Email):  " +
                                           string.Format("{0}/{1}", pt.Person.Name,
                                                         pt.Person.Email),
                                           clr);

            c.Colspan = 3;

            aTable.AddCell(c);

            foreach (Comment comment in pt.Comment)
            {
                string comm = string.Format("{0} ({1},{2})\n",
                                            comment.Text,
                                            pt.Person.Name,
                                            pt.Person.Email);
                aTable.AddCell(getColoredTxtCell("Comment", clr));
                aTable.AddCell(getColoredTxtCell(comm, clr));
                aTable.AddCell(getColoredTxtCell(string.Format("{0},{1}",
                                                               comment.Person.Name,
                                                               comment.Person.Email), clr));
            }

            foreach (Attachment at in pt.Attachment)
            {
                aTable.AddCell(getColoredTxtCell("Attachment", clr));

                BitmapSource          src        = MiniAttachmentManager.GetAttachmentBitmap2(at);
                System.Drawing.Image  drawingImg = BitmapSourceToBitmap(src);
                iTextSharp.text.Image itextImg   = iTextSharp.text.Image.GetInstance(drawingImg, BaseColor.WHITE);
                itextImg.ScaleToFit(150, 200);
                aTable.AddCell(getColoredImgCell(itextImg));

                aTable.AddCell(getColoredTxtCell("", clr));
            }

            return(aTable);
        }