Пример #1
0
        private void button19_Click(object sender, System.EventArgs e)
        {
            C1.C1Pdf.C1PdfDocument pdf = new C1.C1Pdf.C1PdfDocument();

            // set up to draw
            Font       font = new Font("Tahoma", 14);
            RectangleF rc   = new RectangleF(100, 100, 300, 28);

            // measure RTF text and adjust the rectangle to fit
            string text = @"Short {\b RTF} snippet with some {\b bold} and some {\i italics} in it.";

            rc.Y      = rc.Bottom + 12;
            rc.Height = pdf.MeasureStringRtf(text, font, rc.Width).Height;

            // render RTF snippet
            pdf.DrawStringRtf(text, font, Brushes.Blue, rc);
            pdf.DrawRectangle(Pens.Black, rc);

            // save the document to a file
            string fileName = tempdir + "rtf.pdf";

            pdf.Save(fileName);
            System.Diagnostics.Process.Start(fileName);
        }