ZSDK - iOS with PCX images

Hello -

 

I'm attempting to include a PCX image on a label using the ZSDK.  For our Android solution, everything is working...  I use storeImage to copy a file from the Android device to the printer and it saves on the printer as as a .pcx file.  Then I use the CPCL PCX command (ie 'PCX90 100 100 !<logo.pcx\r\n') to include the image on the label.

 

But the same approach doesn't seem to work for iOS?  There, I'm using the storeImage method, but it copies/converts the source image file to a .GRF file on the printer.   So the CPCL PCX command doesn't work.  I've tried both 'PCX90 100 100 !<logo.pcx\r\n' and 'PCX90 100 100 !<logo.grf\r\n'.  So...

 

Is there a way to use the iOS version of the ZSDK_API to move a file from the iOS file system to a pcx file on the printer (so the CPCL will work)? ... or

Is there a CPCL command that will print a GRF image on a label?

 

I'm using a QLN320 printer.  We have a bunch of CPCL code that I would prefer not to switch to ZPL.

 

Thanks.

Manuel Caicedo-...
Hello Mark,Please, could you

Hello Mark,

Please, could you tell us if the printer has configured the printer language in CPCL or LINE_PRINT, also if you can share the CPCL code?

Technically, the LINK-OS SDK will be selecting the type of format in PCX or GRF to be stored depending on the printer language of the printer.

Thanks,

MC

PD: CPLC is one of our Legacy printer languages. We are recommending to developers migrate from CPCL to ZPL due to that ZPL will be the only printer language that will be supported in the future with improvement and new features.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Josh Vance
Hi Manuel -The LINK-OS ZSDK

Hi Manuel -

The LINK-OS ZSDK_API documentation for iOS says the following for the

storeImage:

*"Stores an image from the Apple® mobile digital device's file system to

the connected printer as a monochrome image.*

*The image will be stored on the printer at printerDriveAndFileName with

the extension GRF. If a drive letter is not supplied, E will be used as the

default (e.g. FILE becomes E:FILE.GRF). If an extension is supplied, it is

ignored (E:FILE.BMP becomes E:FILE.GRF)."*

That implies that for iOS, the file is always copied as a GRF file.

Are you saying in your reply that storeImage on iOS will actually save as a

PCX if the printer is in CPCL mode (counter to the documentation)?

The cpcl that we send is dynamic, but here's a simplified example:

!0 200 200 800 1

PW 800

NO-PACE

BAR-SENSE

TEXT270 5 1 295 50 SOMETEXTHERE

PCX90 40 490 !<logo.pcx

FORM

PRINT

In this example logo.pcx is the file that I tried to send to the printer.

Using the android SDK, it works fine... logo.pcx is written to the printer

and referenced correctly in the cpcl. The label prints fine, showing the

pcx image. Using the iOS SDK, the label doesn't print. I believe that's

because the file is written to the printer as a GRF file, so logo.pcx

doesn't exist on the printer.

So...

1. How can I force the storeImage method in the iOS SDK to store the file

as a PCX file so that I can use the same CPCL command for both platforms?

Is there an SDK method to use to force the printer into CPCL instead of

LINE_PRINT before I issue the storeImage method? Will that cause the

storeImage method to write a PCX instead of a GRF? or...

2. How do I use CPCL to print a GRF file. The PCX90 command will not work

with logo.grf... PCX90 40 490 !<logo.grf doesn't work. Is there a GRF90

CPCL command?

Thanks.

Josh

On Tue, Jan 17, 2017 at 12:28 PM, MANUEL CAICEDO-RIVERA <

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Manuel Caicedo-...
Hi Josh,In order to force the

Hi Josh,

In order to force the printer to be recognized as a CPCL printer, you will need to use the ZebraPrinterFactory getInstance call which takes the cpclPrefixes parameter.  If you pass “V68” as one of the prefixes, the resulting ZebraPrinter object should be in CPCL mode.  Using that ZebraPrinter object to download the image will cause the image downloads to write out in PCX format.

There is not a CPCL command to print a GRF image.

Thanks,

MC

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


mahmoud zahran
Are you solve it?I have the

Are you solve it?
I have the same problem

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Mahmound,Storing image to

Hi Mahmound,

Storing image to the printer as *.PCX file through iOS SDK API storeImage is not an issue. To do so, we need to make sure the following:

1. The printer is set to CPCL mode or line_print mode (! U1 setvar "device.languages" "line_print")

2. Get the printer instance with the CpclPrefixes through getInstance:withCpclPrefixes:error API. For example, for my current iMZ320 printer, the firmware is "V73.20.10Z". Then I would use "V73" as the prefix to get a CPCL printer instance through the getInstance API

    self.printer = [ZebraPrinterFactory getInstance:self.connection withCpclPrefixes:[NSArray arrayWithObjects:@"V73", nil] error:&error];

Then, we use this CPCL printer instance to create a GraphicUtil object and call the storeImage API on this GraphicUtil object. Then the image will be sent to the printer and stored on the printer as an *.PCX file.

Unfortunately, the API documentation doesn't provide the above details. Hope this helps.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


mahmoud zahran
you can see this link is

you can see this link is describe  what the problem exactly

https://stackoverflow.com/questions/50795526/print-an-image-and-text-to-receipt-using-cpcl-in-android-mz320-using-android

I tried to print image and text in receipt using Cpcl format like that

template. I have an example set logo as a variable and use function to read

the image as string but that image in example is CPCL format I tried a lot

to get my logo as a cpcl format but i can't so I need to know how to get my

image logo as cpcl format or another way to set image and text like that

templete.

//this template used to design my ticket which it has image and text

in the same ticket like what i need.

    ! 0 200 200 1050 1

    PW 575

    TONE 0

    SPEED 3

    ON-FEED IGNORE

    NO-PACE

    BAR-SENSE

    BT 0 4 6

    B 128 3 30 120 20 0 $

  
  
/* the line below is used to set image as a string variable initialized
  in code from image i have in the worked example which its extension
  logo.cpcl" I don't know how it comes? and i need to change new logo to
  Cpcl from png too "newlogo.png -> newlogo.cpcl" "pcx" x, y, data"*/


  PCX
420 790 ${Logo}

  ML
32

  T270
7 0 550 170 ${typeTicket}

  ENDML

  ML
32

  T270
7 0 498 170 ${validPeriod}

  ENDML

  ML
25

  T270
7 0 446 170 ${park}

  ENDML

  ML
32

  T270
7 0 370 170 ${price}

  ENDML

  ML
25

  T270
7 0 300 170 ${termsOfUse}

  ENDML

  PRINT

PrinterUtil.readFormat(context, R.raw.logo));

//this line I use to call the function to read cpcl image!
//and here we got the image from resources

result
= StringUtils.replace(result, "${Logo}", PrinterUtil.readFormat(context, R.raw.logo));


//this is the code used to read image as a string and it works perfectly with the example.

public static String readFormat(Context context, int formatRes) {

 
InputStream is = null;

  
try {

  is
= context.getResources().openRawResource(formatRes);

  
try {

  
return readString(is);

 
} catch (IOException e) {

  
return null;

 
}

 
} finally {

  
if (is != null) {

  
try {

  is
.close();

 
} catch (IOException e) {

 
}

 
}

 
}

}

java <https://stackoverflow.com/questions/tagged/java> android

<https://stackoverflow.com/questions/tagged/android>

<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&>

Sender

notified by

Mailtrack

<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&>

06/18/18,

10:14:23 AM

‫في الأربعاء، 13 يونيو 2018 في 5:48 م تمت كتابة ما يلي بواسطة ‪Steven Si‬‏

<‪zebra-dev@zebra-dev-v8.hosted.jivesoftware.com‬‏>:‬

Zebra Technologies Developer Portal <https://developer.zebra.com/>

ZSDK - iOS with PCX images

reply from Steven Si

<https://developer.zebra.com/people/SSi1?et=watches.email.thread> in *Our

Community* - View the full discussion

<https://developer.zebra.com/message/97730?et=watches.email.thread#97730>

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments