Hi all,
I need to convert PrintDocument to Pdf . How can I do this.
What I have tried:
private void button1_Click(object sender, EventArgs e)
{
PrintDocument p = new PrintDocument();
p.DefaultPageSettings.PaperSize = new PaperSize("Custom", 755, 378);
p.PrintPage += delegate(object sender1, PrintPageEventArgs e1)
{
e1.Graphics.DrawString(dateTimePicker1.Text, new Font("verdana", 10), new
SolidBrush(Color.Black), new RectangleF(603, 95,
p.DefaultPageSettings.PrintableArea.Width,
p.DefaultPageSettings.PrintableArea.Height));
e1.Graphics.DrawString(label3.Text, new Font("verdana", 10), new
SolidBrush(Color.Black), new RectangleF(159, 171,
p.DefaultPageSettings.PrintableArea.Width,
p.DefaultPageSettings.PrintableArea.Height));
e1.Graphics.DrawString(label5.Text, new Font("verdana", 10), new
SolidBrush(Color.Black), new RectangleF(618, 278,
p.DefaultPageSettings.PrintableArea.Width,
p.DefaultPageSettings.PrintableArea.Height));
e1.Graphics.DrawString(label7.Text, new Font("verdana", 10), new
SolidBrush(Color.Black), new RectangleF(111, 218,
p.DefaultPageSettings.PrintableArea.Width,
p.DefaultPageSettings.PrintableArea.Height));
};
p.Print();
}
This is what I have done. Here instead of printing to a printer.I need to save it as a Pdf document.How can I do this.Any help will be really appreciated.