# encoding: utf-8 module Zebra module Zpl class Label class InvalidPrintSpeedError < StandardError; end class InvalidPrintDensityError < StandardError; end class PrintSpeedNotInformedError < StandardError; end attr_writer :copies attr_reader :elements, :tempfile attr_accessor :width, :length, :print_speed def initialize(options = {}) options.each_pair { |key, value| self.__send__("#{key}=", value) if self.respond_to?("#{key}=") } @elements = [] end def print_speed=(s) raise InvalidPrintSpeedError unless (0..14).include?(s) @print_speed = s end def copies @copies || 1 end def <<(element) element.width = self.width if element.respond_to?("width=") && element.width.nil? elements << element end def dump_contents(io = STDOUT) check_required_configurations # Start format io << "^XA" # ^LL