我使用Epson的ePOS SDK,它允许通过wifi连接到打印机(TM-T88V)。链接为sdk(http://pos.epson.com/mobilesdks/index.htm)使用ePOS SDK打印UIImage
我正在使用此代码从URL加载UIImage。
NSData* data = [[NSData alloc] initWithContentsOfUrl:_url];
UIImage* image = [UIImage imageWithData:data];
然后打印图像(使用EPOS)注:我将跳过连接的部分,因为它不包括我的问题。
EposBuilder* builder = [EposBuilder alloc] initWithPrinterModel:@"TM-T88V" lang:EPOS_OC_MODEL_ANK];
EposPrint* printer = [[EposPrint alloc] init];
int retVal = EPOS_OC_SUCCESS;
unsigned long status = 0;
retVal = [builder addImage:image X:0 Y:0 Width:image.size.width Height:image.size.Height Color: EPOS_OC_COLOR_1];
retVal = [printer sendData:builder Timeout:10000 Status:&status];
现在我的问题是,打印的结果是小了很多,看到图像的大小为271x368px。请参阅下面的图像样本
有关如何使其正确打印的任何想法?我也发现这个Printing UIImage using AirPrint causes cut-off content它给了一个缩放图像的链接,但它不起作用。有任何想法吗?谢谢。
任何人对此有一个解决方案吗? – Iya 2016-03-04 07:50:16
我建议你根据纸张尺寸 – 2017-12-22 11:15:38