AODL.ExternalExporter.PDF.Document.ContentConverter.ImageConverter.Convert C# (CSharp) Метод

Convert() публичный Метод

Converts the specified graphic.
public Convert ( Graphic graphic ) : iTextSharp.text.Image
graphic AODL.Document.Content.Draw.Graphic The graphic.
Результат iTextSharp.text.Image
		public iTextSharp.text.Image Convert(Graphic graphic)
		{
			try
			{
				iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(graphic.GraphicRealPath);
				img.SetDpi(graphic.Frame.DPI_X, graphic.Frame.DPI_X);
				img = this.ScaleIfNessarry(img, graphic.Frame);	
				img = this.SetImageProperties(img, graphic.Frame);
				//img.Alignment = iTextSharp.text.Image.TEXTWRAP;
//				img.ScalePercent(50.0f);
//				img.RotationDegrees = -45.0f;
				//img.ScaleAbsolute(100, 100);
				return img;
			}
			catch(Exception)
			{
				throw;
			}
		}

Usage Example

Пример #1
0
        /// <summary>
        /// Converts the specified paragraph.
        /// </summary>
        /// <param name="paragraph">The paragraph.</param>
        /// <returns>The PDF paragraph.</returns>
        public static iTextSharp.text.Paragraph Convert(AODL.Document.Content.Text.Paragraph paragraph)
        {
            try
            {
                iTextSharp.text.Font font;
                if((ParagraphStyle)paragraph.Style != null
                    && ((ParagraphStyle)paragraph.Style).TextProperties != null
                    && ((ParagraphStyle)paragraph.Style).TextProperties.FontName != null)
                    font = TextPropertyConverter.GetFont(
                        ((ParagraphStyle)paragraph.Style).TextProperties);
                else
                    font = DefaultDocumentStyles.Instance().DefaultTextFont;

                ParagraphExt paragraphPDF = new ParagraphExt("", font);
                foreach(object obj in paragraph.MixedContent)
                {
                    if(obj is AODL.Document.Content.Text.FormatedText)
                    {
                        paragraphPDF.Add(FormatedTextConverter.Convert(
                            obj as AODL.Document.Content.Text.FormatedText));
                    }
                    if(obj is AODL.Document.Content.Text.SimpleText)
                    {
                        paragraphPDF.Add(SimpleTextConverter.Convert(
                            obj as AODL.Document.Content.Text.SimpleText, font));
                    }
                    else if(obj is AODL.Document.Content.Text.TextControl.TabStop)
                    {
                        paragraphPDF.Add(SimpleTextConverter.ConvertTabs(
                            obj as AODL.Document.Content.Text.TextControl.TabStop, font));
                    }
                    else if(obj is AODL.Document.Content.Text.TextControl.WhiteSpace)
                    {
                        paragraphPDF.Add(SimpleTextConverter.ConvertWhiteSpaces(
                            obj as AODL.Document.Content.Text.TextControl.WhiteSpace, font));
                    }
                    else if(obj is AODL.Document.Content.Draw.Frame)
                    {
                        DrawFrameConverter dfc = new DrawFrameConverter();
                        paragraphPDF.Add(dfc.Convert(
                            obj as AODL.Document.Content.Draw.Frame));
                    }
                    else if(obj is AODL.Document.Content.Draw.Graphic)
                    {
                        ImageConverter ic = new ImageConverter();
                        paragraphPDF.Add(ic.Convert(
                            obj as AODL.Document.Content.Draw.Graphic));
                    }
                }
                paragraphPDF = ParagraphConverter.ConvertParagraphStyles(paragraph, paragraphPDF);
                // add new line
                paragraphPDF.Add(iTextSharp.text.Chunk.NEWLINE);
                return paragraphPDF;
            }
            catch(Exception)
            {
                throw;
            }
        }
All Usage Examples Of AODL.ExternalExporter.PDF.Document.ContentConverter.ImageConverter::Convert