コード例 #1
0
        // <exception cref="ConnectionException"></exception>
        // <exception cref="IOException"></exception>
        // <exception cref="NotSupportedException"></exception>
        // <exception cref="System.Security.SecurityException"></exception>
        // <exception cref="UnauthorizedAccessException"></exception>
        // <exception cref="Zebra.Sdk.Card.Exceptions.ZebraCardException"></exception>
        // <exception cref="Zebra.Sdk.Device.ZebraIllegalArgumentException"></exception>

        private ZebraCardImageI DrawCarnetBack(ZebraGraphics graphics, PrintType printType, DataTable data)
        {
            int positionx = 775;
            int positiony = 380;

            Font   font             = new Font("Arial", 7, FontStyle.Bold);
            Font   fontIGSS         = new Font("Arial", 9, FontStyle.Bold);
            Font   fontFechaEmision = new Font("Arial", 5, FontStyle.Regular);
            string Recomendaciones  = "La  empresa no se hace responsable por el mal uso de este carné, " +
                                      "el cual es válido únicamente dentro de nuestras instalaciones y durante el periodo de relación laboral." +
                                      " En caso  de emergencia  comunicarse con Recursos Humanos   al 7820-1700.";
            string NumeroDeEmpleado = data.Rows[0]["NumeroDeEmpleado"].ToString();
            string ImpresionCarnet  = data.Rows[0]["ImpresionCarnet"].ToString();
            string AfiliacionIGSS   = data.Rows[0]["AfiliacionIGSS"].ToString();

            graphics.Initialize(0, 0, OrientationType.Landscape, printType, Color.White);

            graphics.DrawText(Recomendaciones, font, Color.Black, 10, 10, 1000, 200, 0, TextAlignment.Left, TextAlignment.Center);


            using (Code39Util code39 = ZebraBarcodeFactory.GetCode39(graphics))
            {
                code39.ValueToEncode  = NumeroDeEmpleado + "-" + ImpresionCarnet;
                code39.QuietZoneWidth = 0;
                code39.DrawBarcode(100, 190, 800, 180);
            }

            if (File.Exists(@"\\nastrfca1\ArchivosAdjuntosSistemas\Carnet\" + NumeroDeEmpleado + "VCARDV3.png"))
            {
                string QRVCardImagePath = @"\\nastrfca1\ArchivosAdjuntosSistemas\Carnet\" + NumeroDeEmpleado + "VCARDV3.png";
                byte[] QRVCardimageData = File.ReadAllBytes(QRVCardImagePath);
                graphics.DrawImage(QRVCardimageData, 10, 380, 270, 270, RotationType.RotateNoneFlipNone);
            }
            else
            {
                positionx = 10;
                positiony = 380;
            }


            graphics.DrawText("Afiliación IGSS: ", font, Color.Black, 280, 405, 600, 45, 0, TextAlignment.Left, TextAlignment.Center);
            if (!string.IsNullOrEmpty(AfiliacionIGSS))
            {
                graphics.DrawText(AfiliacionIGSS, fontIGSS, Color.Black, 280, 435, 600, 50, 0, TextAlignment.Left, TextAlignment.Center);
            }

            graphics.DrawText("Teléfono Clínica Médica:", font, Color.Black, 280, 480, 600, 45, 0, TextAlignment.Left, TextAlignment.Center);
            graphics.DrawText("7820 1746", fontIGSS, Color.Black, 280, 510, 600, 45, 0, TextAlignment.Left, TextAlignment.Center);
            graphics.DrawText("Fecha de Emisión:", fontFechaEmision, Color.Black, 280, 540, 600, 45, 0, TextAlignment.Left, TextAlignment.Center);
            graphics.DrawText(DateTime.Now.ToString("dd/MM/yyyy"), fontFechaEmision, Color.Black, 280, 570, 600, 45, 0, TextAlignment.Left, TextAlignment.Center);



            using (QRCodeUtil qrCode = ZebraBarcodeFactory.GetQRCode(graphics))
            {
                qrCode.ValueToEncode = NumeroDeEmpleado;
                qrCode.DrawBarcode(positionx, positiony, 180, 180);
            }

            return(graphics.CreateImage());
        }