Rob Prime wrote:http://faq.javaranch.com/java/AvailableDoesntDoWhatYouThinkItDoes
Use a ByteArrayOutputStream to write to instead.
Great, ByteArrayOutputStream seems to work. Now a dark square is being printed to the label. So far so good
When sending data to the printer I have to send some parameters as well, i.e. the position (p1, p2) and the width (p3) and lenght (p4) of the image in bytes.
I am unsure about how to calculate p3 and p4? What is the width of graphic in bytes? And what is length of graphic in dots? I don´t get it.
I got the size of the image by using:
int imageSize = graphic.length;
EPL2 Documentation of GW:
p3 =Width of graphic in bytes. Eight (8) dots = One (1) byte of data
p4 =Length of graphic in dots (or print lines).
DATA = Data must be in bytes. Multiply
the width in bytes (p3) by the number
of print lines (p4) for the total
amount of graphic data. The printer automatically
calculates the exact size of
the data block based upon this formula.
Full EPL2 documentation: