I would like to develop a windows application to generate PDF with the help of pdfsharp.dll file.How to get a line break between the 2 lines in pdf.
Here is my code.
private void button1_Click(object sender, EventArgs e)
{
PdfDocument pdf = new PdfDocument();
PdfPage pg = pdf.AddPage();
XGraphics grp = XGraphics.FromPdfPage(pg);
grp.MUH = PdfFontEncoding.Unicode;
grp.MFEH = PdfFontEmbedding.Default;
XFont ft = new XFont("Microsoft Sans Serif", 15, XFontStyle.Bold);
grp.DrawString("This is my first pdf", ft, XBrushes.LightGreen, new XRect(0, 0, pg.Width.Point, pg.Height.Point), XStringFormats.TopCenter);
string pdffilename = "Converting Pdf";
XPen pn = new XPen(XColors.Blue, 2);
grp.DrawLine(pn, 2, 80, 612, 80);
grp.DrawString("Second line", ft, XBrushes.Black, new XRect(0, 0, pg.Width.Point, pg.Height.Point), XStringFormats.TopLeft);
pdf.Save(pdffilename);
Process.Start(pdffilename);
}
I would like to generate the output like this
This is my first Pdf
----------------------------------------------------------------------------------
Second line