private void previsualizar_clausula(Decimal ID_CON_REG_CLAUSULAS_PERFIL)
    {
        condicionesContratacion _condicionesContratacion = new condicionesContratacion(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString());
        DataTable tablaInfoClausula = _condicionesContratacion.obtenerClausulasPorIdCluasula(ID_CON_REG_CLAUSULAS_PERFIL);
        DataRow filaInfo = tablaInfoClausula.Rows[0];

        StreamReader archivo = new StreamReader(Server.MapPath(@"~\plantillas_reportes\clausulas.htm"));

        tools _tools = new tools();

        String html_completo = "<html><body>";
        html_completo += archivo.ReadToEnd();
        html_completo += "</body></html>";

        archivo.Dispose();
        archivo.Close();

        if (Session["idEmpresa"].ToString() == "1")
        {
            html_completo = html_completo.Replace("[NOMBRE_EMPRESA]", tabla.VAR_NOMBRE_SERTEMPO);
        }
        else
        {
            html_completo = html_completo.Replace("[NOMBRE_EMPRESA]", tabla.VAR_NOMBRE_EYS);
        }
        html_completo = html_completo.Replace("[NOMBRE_TRABAJADOR]", "NOMBRE DEL TRABAJADOR");
        html_completo = html_completo.Replace("[NOMBRE_CLAUSULA]", filaInfo["NOMBRE"].ToString());
        html_completo = html_completo.Replace("[ENCABEZADO_CLAUSULA]", filaInfo["ENCABEZADO"].ToString());
        html_completo = html_completo.Replace("[CONTENIDO_CLAUSULA]", filaInfo["DESCRIPCION"].ToString());

        usuario _usuario = new usuario(Session["idEmpresa"].ToString());
        DataTable tablaInfoUsuario = _usuario.ObtenerInicioSesionPorUsuLog(Session["USU_LOG"].ToString());
        if (tablaInfoUsuario.Rows.Count <= 0)
        {
            html_completo = html_completo.Replace("[CIUDAD_FIRMA]", "Desconocida");
        }
        else
        {
            DataRow filaInfoUsuario = tablaInfoUsuario.Rows[0];
            html_completo = html_completo.Replace("[CIUDAD_FIRMA]", filaInfoUsuario["NOMBRE_CIUDAD"].ToString());
        }

        html_completo = html_completo.Replace("[DIAS]", DateTime.Now.Day.ToString());
        html_completo = html_completo.Replace("[MES]", _tools.obtenerNombreMes(DateTime.Now.Month));
        html_completo = html_completo.Replace("[ANNO]", DateTime.Now.Year.ToString());

        String filename = "previsulizador_clausula";

        HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;FileName=" + filename + ".pdf");

        Response.Clear();
        Response.ContentType = "application/pdf";

        iTextSharp.text.Document document = new iTextSharp.text.Document(PageSize.A4, 40, 40, 80, 40);

        iTextSharp.text.pdf.PdfWriter writer = PdfWriter.GetInstance(document, Response.OutputStream);

        pdfEvents PageEventHandler = new pdfEvents();
        writer.PageEvent = PageEventHandler;

        if (Session["idEmpresa"].ToString() == "1")
        {
            PageEventHandler.dirImagenHeader = Server.MapPath("~/imagenes/reportes/logo_sertempo.png");
        }
        else
        {
            PageEventHandler.dirImagenHeader = Server.MapPath("~/imagenes/reportes/logo_eficiencia.png");
        }

        PageEventHandler.fechaImpresion = DateTime.Now;
        PageEventHandler.tipoDocumento = "clausula";

        document.Open();

        String tempFile = Path.GetTempFileName();

        using (StreamWriter tempwriter = new StreamWriter(tempFile, false))
        {
            tempwriter.Write(html_completo);
        }

        List<IElement> htmlarraylist = HTMLWorker.ParseToList(new StreamReader(tempFile), new StyleSheet());
        foreach (IElement element in htmlarraylist)
        {
            document.Add(element);
        }

        document.Close();
        writer.Close();

        Response.End();

        File.Delete(tempFile);
    }