Select your printer model

Parameters are refined by the selected printer.

addImage


Adds a raster image print command to the command buffer.

Prints UIImage class graphics.

A specified area of UIImage class graphics is binarized according to the mode, halftone, and brightness parameters and converted into a raster image data.

The converted image is compressed or not compressed before transmission according to the compress parameter value.

One pixel of an image corresponds to one dot of the printer. When a transparent color is contained in the image, the background of the image is assumed to be white.

Syntax

 
- (int) addImage:(UIImage *)data x:(long)x y:(long)y width:(long)width height:(long)height color:(int)color mode:(int)mode halftone:(int)halftone brightness:(double)brightness compress:(int)compress;

Parameter

data

Specifies an instance of the UIImage class.

x

Specifies the horizontal start position of the print area (in pixels).

Value

Description

Integer from 0 to 65534

Horizontal start position of the print area (in pixels)

y

Specifies the vertical start position of the print area (in pixels).

Value

Description

Integer from 0 to 65534

Vertical start position of the print area (in pixels)

width

Specifies the width of the print area (in pixels).

Value

Description

Integer from 1 to 65535

Width of the print area (in pixels).

height

Specifies the height of the print area (in pixels).

Value

Description

Integer from 1 to 65535

Height of the print area (in pixels).

color

Specifies the color.

Value

Description

EPOS2_COLOR_NONE

No printing

EPOS2_COLOR_1

First color

EPOS2_COLOR_2

Second color

EPOS2_COLOR_3

Third color

EPOS2_COLOR_4

Fourth color

EPOS2_PARAM_DEFAULT

Specifies the default value (first color).

mode

Specifies the color mode.

Value

Description

EPOS2_MODE_MONO

Monochrome (2 scales)

EPOS2_MODE_GRAY16

Multi-gradation (16 scales)

EPOS2_MODE_MONO_HIGH_DENSITY

Monochrome (2 scales), double density

EPOS2_PARAM_DEFAULT

Specifies the default (monochrome (2 scales)).

halftone

Specifies the halftone processing method.

Value

Description

EPOS2_HALFTONE_DITHER

Dithering (appropriate for printing graphics only)

EPOS2_HALFTONE_ERROR_DIFFUSION

Error diffusion (appropriate for printing text and graphics)

EPOS2_HALFTONE_THRESHOLD

Threshold (appropriate for printing text only)

EPOS2_PARAM_DEFAULT

Specifies the default (dithering).

Effective for the monochrome (2 scales) color mode only.

brightness

Specifies the brightness compensation value.

Value

Description

Real number from 0.1 to 10.0

Brightness compensation (gamma correction) value

EPOS2_PARAM_DEFAULT

Default (1.0)

When a value other than 1.0 is specified for the brightness compensation value, processing gets slower.

compress

Enables or disables compression.

Compressing print images can prevent white banding or streaks from occurring on printed images.

This works well when connecting with the printer using Bluetooth.

Value

Description

EPOS2_COMPRESS_DEFLATE

Compresses the image.

EPOS2_COMPRESS_NONE

Does not compress the image.

EPOS2_COMPRESS_AUTO

Automatically chooses to or not to compress the image.

EPOS2_PARAM_DEFAULT

Default
(automatically chooses to or not to compress the image internally)

Return value

Error status

Description

EPOS2_SUCCESS

The function was executed successfully.

EPOS2_ERR_PARAM

An invalid parameter was passed.

EPOS2_ERR_MEMORY

Memory necessary for processing could not be allocated.

EPOS2_ERR_FAILURE

An unknown error occurred.

Supplementary explanation

  • Since it takes time to send and receive large amounts of data over BLE connection, this API cannot be used with BLE connection.
  • Use this API at the "beginning of a line." If this API is used elsewhere, it will be ignored.
  • If the area specified by x/y and width/height does not fit within the image size specified by data parameter, EPOS2_ERR_PARAM will be returned.
  • The "compress" parameter is effective when the printer is connected via Bluetooth. For other printers, specify EPOS2_COMPRESS_AUTO.
  • Model

    Restriction

    TM-m10

    No restriction

    TM-m30/TM-m30II/TM-m30II-H/TM-m30II-NT/TM-m30II-S/
    TM-m30II-SL/TM-m30III/TM-m30III-H

    No restriction

    TM-m50/TM-m50II-H

    No restriction

    TM-P20/TM-P20II

    No restriction

    TM-P60II (Receipt)

    Firmware version 5.14 ESC/POS or later

    TM-P60II (Peeler)

    Firmware version 6.14 ESC/POS or later

    TM-P80

    Firmware version 1.02 ESC/POS or later

    TM-P80AC

    Firmware version 2.01 ESC/POS or later

    TM-P80II

    No restriction

    TM-T20II/TM-T20III

    No restriction

    TM-T70II

    No restriction

    TM-T82III

    No restriction

    TM-T88V/TM-T88VI

    No restriction

  • Printing may get slower if a transparent image is printed.
  • The multi-gradation and the compression of image data are not supported in the page mode. If you set those in the page mode, nothing will be printed.
  • Set an image size appropriate for the printer. If you set to print a large image, the API commands will be succeeded, but the printer may print nothing.
  • This API consumes a lot of the buffer provided in the printer. When using this API for Epos2LFCPrinter class, be sure to check the buffer size of the printer.
 

Quick Access

  • [Name]
  • [Format]
  • [Range]
  • [Description]
  • [Notes]

Epson ePOS SDK includes patented or patent pending functions. The contents must not be disclosed to third parties.


Epson ePOS SDK for iOS

Jump to the top