Example #1
0
        private void InsertParagraphAndInlines(RadFixedDocumentEditor editor, FontFamily fontFamily)
        {
            #region radpdfprocessing-editing-radfixeddocumenteditor_2
            editor.InsertParagraph();
            #endregion

            #region radpdfprocessing-editing-radfixeddocumenteditor_3
            editor.InsertRun("text");
            editor.InsertRun(fontFamily, "text");
            #endregion

            #region radpdfprocessing-editing-radfixeddocumenteditor_4
            editor.InsertLine("Line of text");
            #endregion
        }
        private static RadFixedDocument GenerateSampleDocument(bool useOnlyStandardFonts)
        {
            FontBase boldItalicFont, normalFont, serifBoldItalic;

            GetDemoFonts(useOnlyStandardFonts, out boldItalicFont, out normalFont, out serifBoldItalic);
            double paragraphFontSize = useOnlyStandardFonts ? 15 : 14;

            RadFixedDocument document = new RadFixedDocument();

            using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
            {
                editor.ParagraphProperties.SpacingBefore       = 10;
                editor.ParagraphProperties.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Center;
                editor.InsertParagraph();
                editor.CharacterProperties.FontSize = 40;
                editor.CharacterProperties.Font     = boldItalicFont;
                editor.InsertRun("Centaur Q3 2014 features");
                editor.InsertLineBreak();
                editor.CharacterProperties.FontSize = 26;
                editor.InsertRun("PdfProcessing");
                editor.InsertLineBreak();

                editor.ParagraphProperties.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Left;
                editor.InsertParagraph();
                editor.CharacterProperties.Font     = boldItalicFont;
                editor.CharacterProperties.FontSize = 20;
                editor.InsertRun("Simple paragraphs drawn with RadFixedDocumentEditor:");
                editor.InsertParagraph();
                editor.CharacterProperties.FontSize = paragraphFontSize;
                editor.CharacterProperties.Font     = normalFont;
                editor.InsertRun(ContentGenerator.GetParagraphText(1));
                editor.InsertParagraph();
                editor.InsertRun(ContentGenerator.GetParagraphText(2));
                editor.InsertParagraph();
                editor.InsertRun(ContentGenerator.GetParagraphText(2));

                editor.InsertParagraph();
                editor.CharacterProperties.Font     = boldItalicFont;
                editor.CharacterProperties.FontSize = 20;
                editor.InsertRun("Paragraph containing images");
                editor.InsertParagraph();
                editor.CharacterProperties.FontSize = paragraphFontSize;
                editor.CharacterProperties.Font     = normalFont;
                editor.InsertRun("This paragraphs contains inline images like this one:");
                using (Stream sampleImage = ContentGenerator.GetSampleImageStream())
                {
                    var imageSource = new Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(sampleImage);
                    editor.InsertImageInline(imageSource, new Size(40, 40));
                    editor.InsertRun(", this one:");
                    editor.InsertImageInline(imageSource, new Size(100, 100));
                    editor.InsertRun(" and this one:");
                    editor.InsertImageInline(imageSource, new Size(100, 60));
                    editor.InsertRun(ContentGenerator.GetParagraphText(2));
                }

                editor.InsertParagraph();
                editor.CharacterProperties.Font     = boldItalicFont;
                editor.CharacterProperties.FontSize = 20;
                editor.InsertRun("Simple table example");
                Table simpleTable = ContentGenerator.GetSimpleTable(40);
                simpleTable.LayoutType = Editing.Flow.TableLayoutType.FixedWidth;
                editor.InsertTable(simpleTable);

                editor.InsertParagraph();
                editor.InsertRun("Complex table with images, geometries and merged cells.");
                Table complexTable = ContentGenerator.GetComplexTable(serifBoldItalic);
                complexTable.LayoutType = Editing.Flow.TableLayoutType.FixedWidth;
                editor.InsertTable(complexTable);

                editor.InsertParagraph();
                editor.InsertRun("THE END");
            }

            return(document);
        }