How to capture and convert textbox into pdf file format?
<p>I want to capture my text box and convert it into the PDF format.<br>
I tried the following code, but it captures the whole screen. How can I capture only my textbox values?</p>

<ol>
<li><p>Code:</p>

<pre><code>try
{
    Rectangle bounds = this.Bounds;
    using (var bitmap = new Bitmap(bounds.Width, bounds.Height))
    {
        using (Graphics g = Graphics.FromImage(bitmap))
        {
            g.CopyFromScreen(new Point(bounds.Left, bounds.Top), Point.Empty,
                             bounds.Size);
        }
        bitmap.Save("C://Rectangle.bmp", ImageFormat.Bmp);
    }
}
catch (Exception e)
{
    MessageBox.Show(e.Message.ToString());
}
</code></pre></li>
<li><p>for exporting pdf:</p>

<pre><code>captureScreen();
var doc = new PdfDocument();
var oPage = new PdfPage();
doc.Pages.Add(oPage);
oPage.Rotate = 90;
XGraphics xgr = XGraphics.FromPdfPage(oPage);
XImage img = XImage.FromFile(@"C://Rectangle.bmp");
xgr.DrawImage(img, 0, 0);
doc.Save("C://RectangleDocument.pdf");
doc.Close();
</code></pre></li>
</ol>
