Пример #1
0
bool 	ZebraPaintEngine::begin ( QPaintDevice * pdev )
{
  QString init = m_CmdPrefix + "XA" + m_CmdPrefix + "LRY";

  if(!customInitString().isEmpty()) {
    init += customInitString();
  }
  else {
    int height = m_parentPrinter->paperRect().height() * (resolution()/72.0); // ?? doc says that paperRect() is in device coordinates, but we get it in PS points
    int width = m_parentPrinter->paperRect().width() * (resolution()/72.0);
    init += QString(m_CmdPrefix + "LL%1" + m_CmdPrefix + "PW%2" + m_CmdPrefix + "CI8").arg(height).arg(width);
  }

  init += "\n";

  m_printBuffer.append(init);
  return true;
}
bool 	SatoPaintEngine::begin ( QPaintDevice * pdev )
{
  Q_UNUSED(pdev);

  int height = m_parentPrinter->paperRect().height() * (resolution()/72.0); // ?? doc says that paperRect() is in device coordinates, but we get it in PS points
  int width = m_parentPrinter->paperRect().width() * (resolution()/72.0);

  QString init = m_CmdPrefix + "A";
  if (height > 1780 || width > 1780) {
      init += m_CmdPrefix + "AX"; // big size
  }
  else {
      init += m_CmdPrefix + "AR"; // standard size
  }
  init += "\n";

  if(!customInitString().isEmpty()) {
    init += customInitString() + "\n";
  }

  init += m_CmdPrefix + QString("A1%1%2\n").arg(height, 4, 10, QLatin1Char('0')).arg(width, 4, 10, QLatin1Char('0'));

  QString recallMask = ReportPrinter::getRecallMask(m_parentPrinter->getParams());
  if(recallMask.length()==3) {
    QChar memory = recallMask[0];
    if(memory=='1' || memory=='2') {
      init += m_CmdPrefix + "CC" + memory;
      init += m_CmdPrefix + "&R" + "," + recallMask.right(2);
      init += "\n";
    }
  }

  m_printBuffer.append(init);

  return true;
}