示例#1
0
        public static void TwoParagraphs(string outputFile)
        {
            Document doc = new Document();
            Section  sec = doc.Sections.AddSection();

            sec.PageSetup.TopMargin    = 0;
            sec.PageSetup.BottomMargin = 0;

            Paragraph par1 = sec.AddParagraph();

            TestParagraphRenderer.FillFormattedParagraph(par1);
            TestParagraphRenderer.GiveBorders(par1);
            par1.Format.SpaceAfter  = "2cm";
            par1.Format.SpaceBefore = "3cm";
            Paragraph par2 = sec.AddParagraph();

            TestParagraphRenderer.FillFormattedParagraph(par2);
            TestParagraphRenderer.GiveBorders(par2);
            par2.Format.SpaceBefore = "3cm";

            PdfDocumentRenderer renderer = new PdfDocumentRenderer();

            renderer.Document = doc;
            renderer.RenderDocument();
            renderer.PdfDocument.Save(outputFile);
        }
示例#2
0
        public static void A1000Paragraphs(string outputFile)
        {
            Document doc = new Document();
            Section  sec = doc.Sections.AddSection();

            sec.PageSetup.TopMargin    = 0;
            sec.PageSetup.BottomMargin = 0;

            for (int idx = 1; idx <= 1000; ++idx)
            {
                Paragraph par = sec.AddParagraph();
                par.AddText("Paragraph " + idx + ": ");
                TestParagraphRenderer.FillFormattedParagraph(par);
                TestParagraphRenderer.GiveBorders(par);
            }
            PdfDocumentRenderer renderer = new PdfDocumentRenderer();

            renderer.Document = doc;
            renderer.RenderDocument();
            renderer.PdfDocument.Save(outputFile);
        }