제목에서 볼 수 있듯이이 문제는 과거에 논의되었습니다. 이전 게시물을 참조 용으로 사용하여 Zebra 레이블 프린터에서 비트 맵 이미지를 인쇄하려고했습니다. 찾고있는 이미지를 인쇄 할 수 없습니다. 논의 된대로 무시하지 마십시오.ZPL 레이블 프린터에서 비트 맵 이미지 인쇄
코드는 아래에 언급 된 참조하시기 바랍니다 :
private string TestImage()
{
string filepath = Application.StartupPath + "\\ImageSymbols\\CSA.bmp";
byte[] bitmapFileData = System.IO.File.ReadAllBytes(filepath);
int fileSize = bitmapFileData.Length;
// Retrieve the image.
Bitmap image1 = new Bitmap(filepath, true);
//Siva - Not in use
Rectangle rect1 = new Rectangle(0, 0, image1.Width, image1.Height);
System.Drawing.Imaging.BitmapData bmpData1 =
image1.LockBits(rect1, System.Drawing.Imaging.ImageLockMode.ReadWrite,
image1.PixelFormat);
//Gets the height and width of the bitmap file
int bitmapDataHeight = image1.Height;
int bitmapDataWidth = image1.Width;
//Gets the size of the bitmap file
long bitmapDataFileSize = new FileInfo(filepath).Length;
//Gets the size of the bitmap file in integer
int bitmapDataFileSizeInt = Convert.ToInt32(bitmapDataFileSize);
//Gets the bitmap offset data in bytes.
byte[] test = bitmapFileData.Skip(10).Take(1).ToArray();
//assigns the bitmap offset data to a array value
byte bitmapDataOffset = test[0]; // i am getting offset value = 62
//changes the bitmap offset data to a integer value
int bitmapDataOffsetInt = Convert.ToInt32(bitmapDataOffset);
//gets the bitmap data file size by subtracting the file size with the bitmap offset data size
int bitmapDataSize = bitmapDataFileSizeInt - bitmapDataOffset;
//int width = 80;
//int height = 80;
int bitsPerPixel = 1; // Monochrome image required!
//int bitmapDataLength = 8160;
double widthInBytes = Math.Ceiling(bitmapDataWidth/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[bitmapDataSize];
//bmpData1
Buffer.BlockCopy(bitmapFileData, bitmapDataOffset, bitmap, 0, bitmapDataSize);
// Invert bitmap colors
for (int i = 0; i < bitmapDataSize; i++)
{
bitmap[i] ^= 0xFF;
}
// Create ASCII ZPL string of hexadecimal bitmap data
string ZPLImageDataString = BitConverter.ToString(bitmapFileData);
ZPLImageDataString = ZPLImageDataString.Replace("-", string.Empty);
string str = "";
return str = "^XA^FO100,100^GFA," + //At Postion 100, 100
bitmapDataSize.ToString() + "," + // Total bytes of data to be placed
bitmapDataSize.ToString() + "," + // Total bytes of data to be placed, repeats as per API
widthInBytes + "," + //
ZPLImageDataString + "^XZ";
을 내가 Zibra 라벨 프린터에 비트 맵 이미지를 인쇄 할 수없는 나는 위의 샘플 코드와 함께. 그리고 나는 bmp를 GRF 이미지 유형으로 변환하기 위해 Zebra net bridge를 사용하고 싶지 않습니다.
어디서 실수를하고 있는지 제안 할 수 있습니까? 오프셋 값이 잘못 표시되는 방식입니까? (현재 62, 나 자신의 이미지에 대해 알지 못한다.) 비트 맵 이미지 오프셋 값을 찾는 수식을 제안 할 수있는 사람이 누구입니까?
안녕하세요 Tisler, 답장을 보내 주셔서 감사합니다. –
Zebra SDK를 사용하려고했는데 관리되지 않는 dll을 가져 오는 데 문제가있었습니다 (해당 DLL에 대한 메소드를 추출 할 수 없음, thirdparty 도구 제한 사항). RZ400 레이블 프린터에서 비트 맵 이미지를 인쇄 할 때의 문제를 해결할 수 있도록 코드를 수정할 수있는 다른 방법이 있습니까? 주어진 이미지의 스케일링을 어떻게 할 수 있습니까? 이걸 좀 도와주세요. –
Multiplatform SDK의 도움말을 사용하여 인쇄 할 수는 있지만 ZPL 명령을 준비해야하므로 문제가 해결되지 않습니다. C# 솔루션에 스케일링이 필요하다는 의견을 주셨을 때, 저를 도와 주시면 감사하겠습니다. –