Crystal reports version free, brings the activeX control inactive by default. Create a form with which you could print directly and achieve something similar to what it required. Made from a method which obtained the report that has been selected, once the process is done, it indicated that it selects the default printer and then it connects to the database.
private void metodoprint(){
//Response.Redirect("../Visor/ConstruirReporte.aspx?Reporte=CRE9&id=" + TextBoxRecibo.Text);
string sDatosVisorReportesCrystal = Request.QueryString["DatosVisorReportes"];
DatosVisorReportesCrystal datosVisorReportesCrystal = Utilidades.UrlDecodeFromString<DatosVisorReportesCrystal>(sDatosVisorReportesCrystal);
string urlReporte = Server.MapPath(datosVisorReportesCrystal.UrlOrigen);
reporte.Load(urlReporte);
NameValueCollection parametros = datosVisorReportesCrystal.Parametros;
if (parametros != null)
{
foreach (string s in parametros.AllKeys)
{
if (!string.IsNullOrWhiteSpace(s))
{
if (!string.IsNullOrEmpty(parametros[s]))
reporte.SetParameterValue(s, parametros[s]);
else reporte.SetParameterValue(s, null);
}
}
}
CrystalReportViewer1.SelectionFormula = datosVisorReportesCrystal.Filtro;
CrystalReportViewer1.ReportSource = reporte;
foreach (TableLogOnInfo tlf in CrystalReportViewer1.LogOnInfo)
{
tlf.ConnectionInfo = ConexionCrystal.getLogOnInfo().ConnectionInfo;
}
// CORRESPONDE A LA CONFIGURACION DE LA IMPRESARORA PREDETERMINADA
// RptParamsWithType = new Dictionary<string, string>();
string NombreImpresora = "";//Donde guardare el nombre de la impresora por defecto
//Busco la impresora por defecto
for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
{
PrinterSettings a = new PrinterSettings();
a.PrinterName = PrinterSettings.InstalledPrinters[i].ToString();
if (a.IsDefaultPrinter)
{
NombreImpresora = PrinterSettings.InstalledPrinters[i].ToString();
}
}
CrystalReportViewer1.DataBind();
CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.ActiveX;
PrinterSettings impresora = new PrinterSettings();
impresora.PrinterName = NombreImpresora;
reporte.SetDatabaseLogon("user", "psw.", "nameserver", "db");
reporte.PrintToPrinter(1, false, 0, 0);
}
I hope I can help those who have this same difficulty