class Pdf417::Lib

Public Class Methods

new click to toggle source

Makes a new PDF417 object for the given text string

static VALUE rb_pdf417_lib_new(VALUE klass) {
  pdf417param *ptr;
  VALUE tdata = Data_Make_Struct(klass, pdf417param, 0, rb_pdf417_lib_cleanup, ptr);
  pdf417init(ptr);
  return tdata;
}

Public Instance Methods

getAspectRatio click to toggle source

The y/x aspect ratio

static VALUE rb_pdf417_lib_getAspectRatio(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return rb_float_new(ptr->aspectRatio);
}
getBitColumns click to toggle source

The number of code columns

static VALUE rb_pdf417_lib_getBitColumns(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->bitColumns);
}
getCodeColumns click to toggle source

The number of code columns

static VALUE rb_pdf417_lib_getCodeColumns(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->codeColumns);
}
getCodeRows click to toggle source

The number of code rows and bitmap lines

static VALUE rb_pdf417_lib_getCodeRows(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->codeRows);
}
getErrorLevel click to toggle source

The error level required 0-8

static VALUE rb_pdf417_lib_getErrorLevel(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->errorLevel);
}
getLenCodewords click to toggle source

The size of the code words, including error correction codes

static VALUE rb_pdf417_lib_getLenCodewords(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return INT2NUM(ptr->lenCodewords);
}
getOutBits click to toggle source

Sets the text to convert into a barcode

static VALUE rb_pdf417_lib_getOutBits(VALUE self) {
  //VALUE list;
  //int lenOutBits, k;
  pdf417param *ptr;

  Data_Get_Struct(self, pdf417param, ptr);
  //lenOutBits = strlen(ptr->outBits);

  //list = rb_ary_new2(lenOutBits);

  //for (k = 0; k < lenOutBits; k++) {
  //  rb_ary_push(list, INT2NUM(ptr->outBits[k]));
  //}

  //return list;
  return rb_str_new2(ptr->outBits);
}
getText click to toggle source

Sets the text to convert into a barcode

static VALUE rb_pdf417_lib_getText(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return rb_str_new2(ptr->text);
}
getYHeight click to toggle source

The y/x dot ratio

static VALUE rb_pdf417_lib_getYHeight(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  return rb_float_new(ptr->yHeight);
}
paintCode click to toggle source

Compute paintCode

static VALUE rb_pdf417_lib_paintCode(VALUE self) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  paintCode(ptr);
  return Qnil;
}
setAspectRatio(aspectRatio) click to toggle source

The y/x aspect ratio

static VALUE rb_pdf417_lib_setAspectRatio(VALUE self, VALUE aspectRatio) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->aspectRatio = NUM2DBL(aspectRatio);
  return rb_float_new(ptr->aspectRatio);
}
setCodeColumns(codeColumns) click to toggle source

The number of code columns

static VALUE rb_pdf417_lib_setCodeColumns(VALUE self, VALUE codeColumns) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->codeColumns = NUM2INT(codeColumns);
  return INT2NUM(ptr->codeColumns);
}
setCodeRows(codeRows) click to toggle source

The number of code rows and bitmap lines

static VALUE rb_pdf417_lib_setCodeRows(VALUE self, VALUE codeRows) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->codeRows = NUM2INT(codeRows);
  return INT2NUM(ptr->codeRows);
}
setErrorLevel(errorLevel) click to toggle source

The error level required 0-8

static VALUE rb_pdf417_lib_setErrorLevel(VALUE self, VALUE errorLevel) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->errorLevel = NUM2INT(errorLevel);
  return INT2NUM(ptr->errorLevel);
}
setLenCodewords(lenCodewords) click to toggle source

The size of the code words, including error correction codes

static VALUE rb_pdf417_lib_setLenCodewords(VALUE self, VALUE lenCodewords) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->lenCodewords = NUM2INT(lenCodewords);
  return INT2NUM(ptr->lenCodewords);
}
setText(text) click to toggle source

Sets the text to convert into a barcode

static VALUE rb_pdf417_lib_setText(VALUE self, VALUE text) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->text = StringValuePtr(text);
  return rb_str_new2(ptr->text);
}
setYHeight(yHeight) click to toggle source

The y/x dot ratio

static VALUE rb_pdf417_lib_setYHeight(VALUE self, VALUE yHeight) {
  pdf417param *ptr;
  Data_Get_Struct(self, pdf417param, ptr);
  ptr->yHeight = NUM2DBL(yHeight);
  return rb_float_new(ptr->yHeight);
}