示例#1
0
        private void CaptureScreen()
        {
            Size s = InvoicePanel.Size;

            memoryImage = new Bitmap(s.Width, s.Height);
            InvoicePanel.DrawToBitmap(memoryImage, InvoicePanel.ClientRectangle);
        }
        private void exportpdf()
        {
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=OrderInvoice.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter   sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            InvoicePanel.RenderControl(hw);
            StringReader sr         = new StringReader(sw.ToString());
            Document     pdfDoc     = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
            HTMLWorker   htmlparser = new HTMLWorker(pdfDoc);

            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
            htmlparser.Parse(sr);
            pdfDoc.Close();
            Response.Write(pdfDoc);
            Response.End();
        }
 public void GetPrintArea()
 {
     memoryImage = new Bitmap(InvoicePanel.Width, InvoicePanel.Height);
     InvoicePanel.DrawToBitmap(memoryImage, new Rectangle(0, 0, InvoicePanel.Width, InvoicePanel.Height));
 }