J'ai une image bitmap dans VB.net que je veux imprimer sur une imprimante Zebra, en utilisant le code ZPLII. J'ai vu l'exemple ici: Working with bitmaps to a ZPL label printer sans chance. Quelqu'un peut-il aider avec ceci? Je me suis cogné la tête contre le mur pendant des jours. Merci d'avance!VB.net Impression d'image à Zebra
Répondre
Vous pouvez utiliser l'utilitaire téléchargeur police pour stocker l'image de l'imprimante, puis le rappeler à l'aide ZPL:
^XA
^FT60,1750^A0B,42,40^XGE:[image_name].GRF^FS
^PQ1,0,1,Y^XZ
j'ai une solution
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text
Class CONVERTBITMAP
''' <summary>
''' Return codeZPL of an bitmap
''' </summary>
''' <param name="BMP2">BITMAP</param>
''' <returns></returns>
Public Shared Function CreateGRF(BMP2 As Bitmap) As String
'Dim bmp2 As Bitmap = Nothing
Dim bmp As Bitmap = Nothing
Dim imgData As BitmapData = Nothing
Dim pixels As Byte()
Dim x As Integer, y As Integer, width As Integer
Dim sb As StringBuilder
Dim ptr As IntPtr
Try
bmp = CONVERTBITMAP.CopyToBpp(BMP2, 1)
imgData = bmp.LockBits(New Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.[ReadOnly], PixelFormat.Format1bppIndexed)
width = Math.Abs(imgData.Stride)
pixels = New Byte(width - 1) {}
sb = New StringBuilder(width * bmp.Height * 2)
ptr = imgData.Scan0
Dim PREVNUM As Integer = 0
For y = 0 To bmp.Height - 1
Marshal.Copy(ptr, pixels, 0, width)
For x = 0 To width - 1
If (x + 1) * 8 > bmp.Width Then
Dim DIF As Integer = ((x + 1) * 8) - bmp.Width
Dim NUM As Integer = (2^(DIF - PREVNUM)) - 1
Dim BYTENOT As Byte = Not (CByte(NUM))
PREVNUM = DIF
If NUM < 255 Then
Dim NOTPX As Byte = Not (pixels(x))
Dim CBYTE2 As Byte = CByte(NUM)
Dim STR As Byte = Format("{0:X2}", NOTPX - CBYTE2)
sb.AppendFormat("{0:X2}", CByte(STR))
Else
sb.AppendFormat("{0:X2}", CByte(0))
End If
Else
sb.AppendFormat("{0:X2}", CByte(Not pixels(x)))
End If
Next
PREVNUM = 0
ptr = ptr.ToInt64 + imgData.Stride 'DirectCast(ptr.ToInt64() + imgData.Stride), IntPtr)
Next
Finally
If bmp IsNot Nothing Then
If imgData IsNot Nothing Then
bmp.UnlockBits(imgData)
End If
bmp.Dispose()
End If
End Try
Return [String].Format("^GFA,{0},{0},{1},", width * y, width) + sb.ToString()
End Function
End Class
puis, pour une utilisation
public function Create_ZPLImage(my_Image As Image) as string
return CONVERTBITMAP.CreateGRF(_Image)
End Sub
travailler pour moi
Vous avez une solution que vous avez copiée de quelque part. Veuillez inclure un attribut à la source. – LarsTech
Je copie le code de mon projet Visual Studio –
Votre réponse originale semblait avoir du code provenant de [Programmer »1bpp en C#] (http://www.wischik.com/lu/programmer/1bpp.html). – LarsTech
- 1. Imprimante Zebra et impression française
- 2. Impression d'EPL2 brut à Zebra Thermal à partir d'Internet Explorer
- 3. VB.Net impression et Marges
- 4. Impression de socket réseau .NET sur Zebra EPL/ZPL
- 5. Impression en mode paysage vb.net
- 6. Impression d'un objet graphique VB.NET
- 7. Impression de la page d'informations dans vb.net
- 8. Aperçu avant impression VB.net avec plusieurs fichiers
- 9. Communication avec Zebra GK420d via le pilote Zebra OPOS
- 10. Zebra Striping avec PHPTAL?
- 11. installer zebra sdk android
- 12. jQuery Zebra selector
- 13. Zebra rows in xslt
- 14. Zebra DatePicker Positioning Issue
- 15. Imprimante Zebra Caractère Russe
- 16. Imprimer Zebra ZM400 à l'aide de Java
- 17. Envoi de commandes directement à Zebra EPL
- 18. Impression de code à barres
- 19. JQGrid zebra striping issue
- 20. Impression à partir de l'application Windows Mobile
- 21. Windows IoT - Imprimante Bluetooth Zebra
- 22. Tablester Zebra widget breaks sortabilité
- 23. Switch Zebra S4M to EPL
- 24. Imprimante Zebra: images imprimées floues
- 25. Zebra SDK Via Hyperloop Android
- 26. Zebra Datepicker - Ne fonctionne pas
- 27. Impression d'un formulaire dans VB.NET sous Windows XP
- 28. Impression en ligne suivante dans un VB.NET Étiquette
- 29. impression java api - impression JComponent à 300dpi
- 30. .Net Impression à partir d'un site Web?
Peut-être que cela peut vous aider http://stackoverflow.com/questions/17787620/prepare-a-zpl-command-for-printing-the-mono-chrome-bitmap-image – RamHS