Beispiel #1
0
    protected void generaPDF(object sender, EventArgs e)
    {
        ReportBC   r            = new ReportBC();
        DataTable  dt           = r.CargarPreEntradaDT(Convert.ToInt32(this.hf_id.Value));
        DataColumn codigobarras = new DataColumn("DOC_IMPRESION");

        codigobarras.DataType = typeof(byte[]);
        dt.Columns.Add(codigobarras);
        Barcode_BC barcode = new Barcode_BC("code128", 005, dt.Rows[0]["DOC_INGRESO_BARRAS"].ToString());

        dt.Columns["DOC_IMPRESION"].ReadOnly = false;
        // dt.Columns["DOC_IMPRESION"].DataType = typeof(System.Drawing.Image);
        dt.Rows[0]["DOC_IMPRESION"] = barcode.Byte;

        DataColumn codigobarras2 = new DataColumn("DOC_PATENTE");

        codigobarras2.DataType = typeof(byte[]);
        dt.Columns.Add(codigobarras2);
        Barcode_BC barcode2 = new Barcode_BC("CODE_39", 003, dt.Rows[0]["TRAI_PLACA"].ToString().ToUpper()); //   dt.Rows[0]["TRAI_PLACA"].ToString().ToUpper());

        dt.Columns["DOC_PATENTE"].ReadOnly = false;
        // dt.Columns["DOC_IMPRESION"].DataType = typeof(System.Drawing.Image);
        dt.Rows[0]["DOC_PATENTE"] = barcode2.Byte;

        ReportDataSource dataSource = new ReportDataSource("DataSet1", dt);

        this.limpiarTodo();

        //   barcode.Symbology = KeepAutomation.Barcode.Symbology.Code11;
        //  barcode.CodeToEncode = row.ProductID.ToString();
        //    barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;

        this.ReportViewer1.LocalReport.DataSources.Clear();
        this.ReportViewer1.LocalReport.DataSources.Add(dataSource);

        Warning[] warnings;
        string[]  streamids;
        string    mimeType;
        string    encoding;
        string    extension;

        //Word
        byte[] bytes = this.ReportViewer1.LocalReport.Render(
            "PDF", null, out mimeType, out encoding,
            out extension,
            out streamids, out warnings);
        //byte[] renderedBytes = this.ReportViewer1.LocalReport.Render("PDF");
        this.Response.Clear();

        this.Response.ContentType = mimeType;

        this.Response.AddHeader("content-disposition", string.Format("attachment; filename=Doc_PreIngreso_{0}{1}{2}", this.txt_buscarDoc.Text, '.', extension));

        this.Response.BinaryWrite(bytes);

        this.Response.End();
    }
Beispiel #2
0
    protected void generaPDF(object sender, EventArgs e)
    {
        ReportBC   r            = new ReportBC();
        DataTable  dt           = r.CargarPreEntradaDT(Convert.ToInt32(hf_id.Value));
        DataColumn codigobarras = new DataColumn("DOC_IMPRESION");

        codigobarras.DataType = typeof(byte[]);
        dt.Columns.Add(codigobarras);
        Barcode_BC barcode = new Barcode_BC("code128", 005, dt.Rows[0]["DOC_INGRESO_BARRAS"].ToString());

        dt.Columns["DOC_IMPRESION"].ReadOnly = false;
        dt.Rows[0]["DOC_IMPRESION"]          = barcode.Byte;

        DataColumn codigobarras2 = new DataColumn("DOC_PATENTE");

        codigobarras2.DataType = typeof(byte[]);
        dt.Columns.Add(codigobarras2);
        Barcode_BC barcode2 = new Barcode_BC("CODE_39", 003, dt.Rows[0]["TRAI_PLACA"].ToString().ToUpper());

        dt.Columns["DOC_PATENTE"].ReadOnly = false;
        dt.Rows[0]["DOC_PATENTE"]          = barcode2.Byte;

        ReportDataSource dataSource = new ReportDataSource("DataSet1", dt);

        limpiarTodo();

        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(dataSource);

        Warning[] warnings;
        string[]  streamids;
        string    mimeType;
        string    encoding;
        string    extension;

        //Word
        byte[] bytes = ReportViewer1.LocalReport.Render(
            "PDF", null, out mimeType, out encoding,
            out extension,
            out streamids, out warnings);
        Response.Clear();

        Response.ContentType = mimeType;

        Response.AddHeader("content-disposition", "attachment; filename=Doc_PreIngreso_" + txt_buscarDoc.Text + '.' + extension);

        Response.BinaryWrite(bytes);

        Response.End();
    }