objective c - Zebra IMZ 320 printing image takes too long (iOS) -
i using zebra imz 320 print pdf document ios (receipt actually) , works. takes 50 seconds print 23 kb pdf document.
i thinking maybe if send in hexadecimal format printer understand, printing time decrease can't find how send in byte format. tried zpl codes understanding converting image .grf format , send printer using utilities images dynamic.
can please me ?
here code send print images :
cgdataproviderref dataprovider = cgdataprovidercreatewithcfdata((cfdataref)pdfdata); cgpdfdocumentref document = cgpdfdocumentcreatewithprovider(dataprovider); size_t npages = cgpdfdocumentgetnumberofpages(document); size_t pagenum; (pagenum = 1; pagenum <= npages; pagenum++) { uiimage* image = nil; cgpdfpageref page = cgpdfdocumentgetpage(document, pagenum); cgrect rect = cgpdfpagegetboxrect(page, kcgpdfartbox); uigraphicsbeginimagecontextwithoptions(rect.size, yes, 2.6); cgcontextref context = uigraphicsgetcurrentcontext(); cgcolorspaceref rgb = cgcolorspacecreatedevicergb(); const cgfloat fillcolors[] = {1.0, 1.0, 1.0, 1.0}; cgcolorref colorref = cgcolorcreate(rgb, fillcolors); cgcontextsetfillcolorwithcolor(context, colorref); cgcontextfillrect(context, rect); cgcolorspacerelease(rgb); cgcolorrelease(colorref); cgcontexttranslatectm(context, 0.0, rect.size.height); cgcontextscalectm(context, 1.0, -1.0); if (page != null) { cgcontextsavegstate(context); cgaffinetransform pdftransform = cgpdfpagegetdrawingtransform(page, kcgpdfcropbox, rect, 0, true); cgcontextconcatctm(context, pdftransform); cgcontextdrawpdfpage(context, page); cgcontextrestoregstate(context); image = uigraphicsgetimagefromcurrentimagecontext(); } uigraphicsendimagecontext(); if (nil != image) { nserror *error = nil; success = [graphicsutil printimage:[image cgimage] atx:0 aty:0 withwidth:x withheight:y andisinsideformat:no error:&error]; } }
thanks lot
note : yes on bluetooth
one way reduce time send text of receipt printer (formatted in printer language) instead of sending pdf image; approach drastically reduce number of bytes have sent on bluetooth, typically under 1k.
Comments
Post a Comment