Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

//hideing the buttons from the page.

btnBack.Hide();
lnkReset.Hide();
lblItem.Hide();
lblQty.Hide();
txtItem.Hide();
txtQty.Hide();
btnAdd.Hide();
btnRemove.Hide();
btnUpdate.Hide();
btnPrint.Hide();

//creating png file of current active window.


System.Drawing.Rectangle bounds = this.Bounds;
using (Bitmap 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("D://test.png", ImageFormat.Png);
}

//creating pdf of the bill.


Document doc = new Document(iTextSharp.text.PageSize.A4,10,20,10,10);
PdfWriter wr = PdfWriter.GetInstance(doc, new FileStream("D:\\MCA III
Sem Project\\"+txtInno.Text+".pdf",FileMode.Create));
doc.Open();
iTextSharp.text.Image PNG =
iTextSharp.text.Image.GetInstance("D://test.png");
PNG.Border = iTextSharp.text.Rectangle.BOX;
PNG.BorderColor = iTextSharp.text.BaseColor.BLACK;
doc.Add(PNG);
doc.Close();

You might also like