Beispiel #1
0
    private static void ImprimirEtiq(Microsoft.Reporting.WebForms.LocalReport etiqueta)
    {
        using (var pd = new System.Drawing.Printing.PrintDocument())
        {
            //configurar impressora
            //pd.PrinterSettings.PrinterName = "Microsoft Print to PDF";
            pd.PrinterSettings.PrinterName = impressora_etiqueta;

            var     pageSettings = new System.Drawing.Printing.PageSettings();
            Margins margins      = new Margins(0, 0, 0, 0);

            var pageSettingsEtiqueta = etiqueta.GetDefaultPageSettings();

            pageSettings.PaperSize = pageSettingsEtiqueta.PaperSize;
            pageSettings.Margins   = pageSettingsEtiqueta.Margins;

            pd.DefaultPageSettings.Margins = margins;
            //pd.DefaultPageSettings = pageSettings;

            pd.PrintPage += Pd_PrintPage;
            _streamAtual  = 0;

            pd.Print();
        }
    }
Beispiel #2
0
        public ActionResult DownloadAnex(int RntID)
        {
            byte[] bytes = null;
            //if (returnId == null)
            //    returnId = "0";
            //int catg = Convert.ToInt32(returnId.Substring(0, 1));
            //int RntID = Convert.ToInt32(returnId.Substring(1, returnId.Length - 1));
            string DocumetNAme = "";

            Microsoft.Reporting.WebForms.LocalReport rpt = new Microsoft.Reporting.WebForms.LocalReport();

            var DBvlu = db.AJ_Stud_Admin_Return_Reg_C(RntID);

            rpt.ReportPath = Server.MapPath(@"~/Reports/Regirstion_Reports/Rdlc_Affi_reg_return_Anax_C.rdlc");
            rpt.DataSources.Add(new ReportDataSource("Rdlc_Affi_reg_return_Anax_C", DBvlu));
            DocumetNAme = "Annex-C" + "." + "PDF";
            rpt.GetDefaultPageSettings();
            bytes = rpt.Render("PDF");


            // bytes = rpt.Render("PDF");
            if (bytes.Length > 0)
            {
                Response.Buffer = true;
                Response.Clear();
                Response.AddHeader("content-disposition", "attachment; filename=" + DocumetNAme);
                Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file
                Response.Flush();                                    // send it to the client to download
                Response.End();
                //  return View();
            }
            return(RedirectToAction("ReturnStatus", "Registration"));
        }
Beispiel #3
0
    private static string CriarDeviceInfo(Microsoft.Reporting.WebForms.LocalReport relatorio)
    {
        var pageSettings = relatorio.GetDefaultPageSettings();

        return(string.Format(
                   System.Globalization.CultureInfo.InvariantCulture,
                   @"<DeviceInfo>
                <OutputFormat>EMF</OutputFormat>
                <PageWidth>{0}in</PageWidth>
                <PageHeight>{1}in</PageHeight>
                <MarginTop>{2}in</MarginTop>
                <MarginLeft>{3}in</MarginLeft>
                <MarginRight>{4}in</MarginRight>
                <MarginBottom>{5}in</MarginBottom>
            </DeviceInfo>",
                   pageSettings.PaperSize.Width / 100m, pageSettings.PaperSize.Height / 100m, pageSettings.Margins.Top / 100m, pageSettings.Margins.Left / 100m, pageSettings.Margins.Right / 100m, pageSettings.Margins.Bottom / 100m));
    }
Beispiel #4
0
    private void Imprimir(Microsoft.Reporting.WebForms.LocalReport relatorio)
    {
        using (var pd = new System.Drawing.Printing.PrintDocument())
        {
            //configurar impressora
            pd.PrinterSettings.PrinterName = "Microsoft Print to PDF";
            var pageSettings          = new System.Drawing.Printing.PageSettings();
            var pageSettingsRelatorio = relatorio.GetDefaultPageSettings();
            pageSettings.PaperSize = pageSettingsRelatorio.PaperSize;
            pageSettings.Margins   = pageSettingsRelatorio.Margins;
            pd.DefaultPageSettings = pageSettings;

            pd.PrintPage += Pd_PrintPage;
            _streamAtual  = 0;
            pd.Print();
        }
    }