Comment générer une dynamique GRF image à ZPL ZEBRA print

J'ai un problème.

Im générer une dynamique d'image BMP et d'essayer de l'envoyer à une imprimante ZEBRA par des commandes ZPL.
J'ai besoin de convertir mon BMP à un GRF image. Je pense que mon Hexadécimal extrait par l'image au format BMP n'est pas correct.

L'image imprimée est floue et incorrect.

C'est mon code:

string bitmapFilePath = @oldArquivo;  //file is attached to this support article
byte[] bitmapFileData = System.IO.File.ReadAllBytes(bitmapFilePath);
int fileSize = bitmapFileData.Length;

Bitmap ImgTemp = new Bitmap(bitmapFilePath);
Size ImgSize = ImgTemp.Size;
ImgTemp.Dispose();

//The following is known about test.bmp.  It is up to the developer
//to determine this information for bitmaps besides the given test.bmp.            
int width = ImgSize.Width;
int height = ImgSize.Height;
int bitmapDataOffset = 62; //62 = header of the image
int bitmapDataLength = fileSize - 62;//8160;    

double widthInBytes = Math.Ceiling(width / 8.0);    

//Copy over the actual bitmap data from the bitmap file.
//This represents the bitmap data without the header information.
byte[] bitmap = new byte[bitmapDataLength];
Buffer.BlockCopy(bitmapFileData, bitmapDataOffset, bitmap, 0, (bitmapDataLength));

//Invert bitmap colors
for (int i = 0; i < bitmapDataLength; i++)
{
    bitmap[i] ^= 0xFF;
}

//Create ASCII ZPL string of hexadecimal bitmap data
string ZPLImageDataString = BitConverter.ToString(bitmap).Replace("-", string.Empty);

string comandoCompleto = "~DG" + nomeImagem + ".GRF,0" + bitmapDataLength.ToString() + ",0" + widthInBytes.ToString() + "," + ZPLImageDataString;
qu'est-ce que le bitmapDataOffset en-tête de l'image, c'est ici? comment obtenir la valeur de 62?

OriginalL'auteur lucasrhuan | 2012-12-27