Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

HTML support text fragment class

$
0
0
HI
i am using below code to write text in PDF.
 TextFragment textFragment = new TextFragment(contentData.Text);
                
            
                // Set text properties
                textFragment.TextState.FontSize = contentData.FontSize;
                
                // textFragment.TextState.Font = FontRepository.FindFont(item.FontFamily);
                if (contentData.BackgroundColor != "")
                {
                    textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.Parse(contentData.BackgroundColor);
                }
                if (contentData.ForegroundColor != "")
                {
                    textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.Parse(contentData.ForegroundColor);
                }
                if (contentData.FontStyle != null)
                {
                    textFragment.TextState.FontStyle = (FontStyles)contentData.FontStyle;
                }
                if (contentData.FontFamily != "")
                {
                    textFragment.TextState.Font = FontRepository.FindFont(contentData.FontFamily);
                }

                textFragment.TextState.LineSpacing = contentData.LineSpacing;
                // specify the location to add TextParagraph
                paragraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;
            
                paragraph.Rectangle = new Aspose.Pdf.Rectangle(contentData.Left, contentData.Bottom, contentData.Width, contentData.Right);
    
                // add fragment to paragraph
                paragraph.AppendLine(textFragment);

here my question is
1. i want to write HTML support text here. textfragment class will support HTML formatted text?
2. without rectangle, i want to write paragraph and text with wrap mode with fixed width, how to write?

Thanks
Shanmuga sundaram C

Viewing all articles
Browse latest Browse all 3131

Trending Articles