public GraphicsInfo CreateBackGraphics(ZebraCardPrinter zebraCardPrinter, ZebraCardPrintDetails printDetails) { using (ZebraCardGraphics graphics = new ZebraCardGraphics(zebraCardPrinter)) { int?fillColour = null; graphics.Initialize(0, 0, OrientationType.Landscape, PrintType.MonoK, fillColour); // Loop through back text, if any if (printDetails.BackPanelText != null & printDetails.BackPanelText.Length > 0) { foreach (var text in printDetails.BackPanelZebraText) { text.Add(graphics); } } // Loop through back images, if any if (printDetails.BackPanelImages != null & printDetails.BackPanelImages.Length > 0) { foreach (var image in printDetails.BackPanelZebraImages) { image.Add(graphics); } } ZebraCardImageI zebraCardImage = graphics.CreateImage(); return(AddImage(CardSide.Back, PrintType.MonoK, 0, 0, -1, zebraCardImage)); } }
private GraphicsInfo BuildGraphicsInfo(ZebraCardImageI zebraCardImage, CardSide side, PrintType printType) { return(new GraphicsInfo { GraphicData = zebraCardImage ?? null, GraphicType = zebraCardImage != null ? GraphicType.BMP : GraphicType.NA, Side = side, PrintType = printType }); }
private GraphicsInfo BuildGraphicsInfo(ZebraCardImageI zebraCardImage, CardSide side, PrintType printType) { GraphicsInfo graphicsInfo = new GraphicsInfo { Side = side, PrintType = printType, GraphicType = zebraCardImage != null ? GraphicType.BMP : GraphicType.NA }; if (zebraCardImage != null) { graphicsInfo.GraphicData = zebraCardImage; } return(graphicsInfo); }
private static GraphicsInfo AddImage(CardSide side, PrintType printType, int xOffset, int yOffset, int fillColor, ZebraCardImageI zebraCardImage) { return(new GraphicsInfo { Side = side, PrintType = printType, GraphicType = zebraCardImage != null ? GraphicType.BMP : GraphicType.NA, XOffset = xOffset, YOffset = yOffset, FillColor = fillColor, Opacity = 0, Overprint = false, GraphicData = zebraCardImage ?? null }); }
private List <GraphicsInfo> DrawGraphics(ZebraCardPrinter zebraCardPrinter, DataTable data) { // Generate image data ZebraCardImageI zebraCardImage = null; //byte[] fontFields = System.Text.Encoding.ASCII.GetBytes("Arial"); List <GraphicsInfo> graphicsData = new List <GraphicsInfo>(); using (ZebraGraphics graphics = new ZebraCardGraphics(zebraCardPrinter)) { if (rdoAmbasCaras.Checked) { // Front side color zebraCardImage = DrawCarnetFront(graphics, PrintType.Color, data); pictureBox1.Image = ByteToImage(zebraCardImage.ImageData); //zebraCardImage = DrawImage(graphics, PrintType.Color, imageData, 0, 0, 450, 150); //graphics.DrawImage(imageData, 0, 450, 150, 0, RotationType.RotateNoneFlipXY); //zebraCardImage = graphics.CreateImage(); graphicsData.Add(AddImage(CardSide.Front, PrintType.Color, 0, 0, -1, zebraCardImage)); graphics.Clear(); //// Front side full overlay graphicsData.Add(AddImage(CardSide.Front, PrintType.Overlay, 0, 0, 1, null)); // Back side mono zebraCardImage = null; zebraCardImage = DrawCarnetBack(graphics, PrintType.MonoK, data); pictureBox2.Image = ByteToImage(zebraCardImage.ImageData); //zebraCardImage = DrawImage(graphics, PrintType.Color, imageData, 0, 0, 450, 150); //graphics.DrawImage(imageData, 0, 450, 150, 0, RotationType.RotateNoneFlipXY); //zebraCardImage = graphics.CreateImage(); graphicsData.Add(AddImage(CardSide.Back, PrintType.MonoK, 0, 0, -1, zebraCardImage)); graphics.Clear(); //// Back side full overlay graphicsData.Add(AddImage(CardSide.Back, PrintType.Overlay, 0, 0, 1, null)); } if (rdoFrontal.Checked) { // Front side color zebraCardImage = DrawCarnetFront(graphics, PrintType.Color, data); pictureBox1.Image = ByteToImage(zebraCardImage.ImageData); //zebraCardImage = DrawImage(graphics, PrintType.Color, imageData, 0, 0, 450, 150); //graphics.DrawImage(imageData, 0, 450, 150, 0, RotationType.RotateNoneFlipXY); //zebraCardImage = graphics.CreateImage(); graphicsData.Add(AddImage(CardSide.Front, PrintType.Color, 0, 0, -1, zebraCardImage)); graphics.Clear(); //// Front side full overlay graphicsData.Add(AddImage(CardSide.Front, PrintType.Overlay, 0, 0, 1, null)); } if (rdoReverso.Checked) { // Back side mono zebraCardImage = null; zebraCardImage = DrawCarnetBack(graphics, PrintType.MonoK, data); pictureBox2.Image = ByteToImage(zebraCardImage.ImageData); //zebraCardImage = DrawImage(graphics, PrintType.Color, imageData, 0, 0, 450, 150); //graphics.DrawImage(imageData, 0, 450, 150, 0, RotationType.RotateNoneFlipXY); //zebraCardImage = graphics.CreateImage(); graphicsData.Add(AddImage(CardSide.Back, PrintType.MonoK, 0, 0, -1, zebraCardImage)); graphics.Clear(); //// Back side full overlay graphicsData.Add(AddImage(CardSide.Back, PrintType.Overlay, 0, 0, 1, null)); } } return(graphicsData); }