Hi rhino000,
Refer the below sample code. After generating the byte array you can simply use File.WriteAllBytes(path,byte) to save the file in the folder like below.
string ddlValue = ddlFont.SelectedItem.Text.ToLower();
Document ds = new Document(PageSize.A4, 10f, 10f, 10f, 10f);
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
PdfWriter writer = PdfWriter.GetInstance(ds, memoryStream);
Font font = null;
ds.Open();
if (ddlValue == "arial")
{
font = FontFactory.GetFont(@"C:\Windows\Fonts\arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 29f, Font.BOLD, BaseColor.RED);
}
else if (ddlValue == "verdana")
{
font = FontFactory.GetFont(@"C:\Windows\Fonts\verdana.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 25f, Font.BOLD, BaseColor.GREEN);
}
else if (ddlValue == "timesnewroman")
{
font = FontFactory.GetFont(@"C:\Windows\Fonts\times.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 39f, Font.BOLD, BaseColor.YELLOW);
}
Paragraph p2 = new Paragraph(new Chunk("This is test", font));
ds.Add(p2);
Paragraph p = new Paragraph(new Chunk(new LineSeparator(0.0F, 100.0F, BaseColor.BLACK, Element.ALIGN_LEFT, 1)));
//LineSeparator line1 = new LineSeparator(1f, 100f, BaseColor.BLACK, Element.ALIGN_LEFT, 1);
ds.Add(p);
ds.Close();
byte[] bytes = memoryStream.ToArray();
System.IO.File.WriteAllBytes(Server.MapPath("~/Files/") + DateTime.Now.ToString("ddMMyyyyHHss") + ".pdf", bytes);
memoryStream.Close();