打印预览未显示正确的格式

时间:2017-04-24 08:04:32

标签: angularjs ionic-framework

我有一个格式化为2列的表单。我使用此插件在我的应用程序上进行了紧急打印:https://github.com/katzer/cordova-plugin-printer并显示打印预览。但它不遵循我的表格的2列格式。我如何打印2列?

这是我的表单的HTML代码:

<form id="myFormMain">
  <div class="row">
      <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly ng-model="mmid" class="form-control">
      </div>
      <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly  ng-model="cardNumber" class="form-control">
      </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3"  readonly  ng-model="fname" class="form-control" >
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3"   readonly ng-model="gender" class="form-control">
    </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
         <input type="text" style="background-color:#d3d3d3"  readonly  ng-model="mname" class="form-control">
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3"  readonly ng-model="birthplace" class="form-control">
    </div>
  </div>

   <div class="row">
    <div class="col-xs-6">
          <input type="text" style="background-color:#d3d3d3" readonly   ng-model="lname" class="form-control">
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly  ng-model="citizenship" class="form-control">
    </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
          <input type="text" style="background-color:#d3d3d3" readonly  ng-model="bday" class="form-control" >
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly  ng-model="sssTinID" class="form-control">
    </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
        <input  type="email" style="background-color:#d3d3d3" readonly  ng-model="email" class="form-control">
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly ng-model="companyName" class="form-control">
    </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
         <input type="text" style="background-color:#d3d3d3" readonly ng-model="mobile" class="form-control">
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly  ng-model="companyAddress" class="form-control" >
    </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
          <!--<input type="text" style="background-color:#d3d3d3" readonly ng-model="address" class="form-control">-->
          <textarea readonly ng-model="address" class="form-control" ></textarea>
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly ng-model="workTitle" class="form-control">
    </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
         <input type="text" style="background-color:#d3d3d3" readonly  ng-model="city" class="form-control" >
    </div>
    <div class="col-xs-6">
         <input type="text" style="background-color:#d3d3d3" readonly ng-model="srcFunds" class="form-control">
    </div>
  </div>

  <div class="row">
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly ng-model="zipcode" class="form-control" >
    </div>
    <div class="col-xs-6">
        <input type="text" style="background-color:#d3d3d3" readonly ng-model="otherSrcFunds" class="form-control" >
    </div>
  </div>
  </form>

这是我在controller.js中的打印功能:

$scope.goPrint = function(divName)
{
  var divEl = document.getElementById('myFormMain');
  var allInputs = divEl.querySelectorAll("input,textarea");
  for( var counter = 0; counter < allInputs.length; counter++)
  {
   var input = allInputs.item(counter);
   input.setAttribute("value", input.value);
  }

  var page = document.getElementById('myFormMain').innerHTML;
  cordova.plugins.printer.print('<html><head><link rel="stylesheet" type="text/css" href="style.css" /></head><body><div><img src="img/kYYXJ9o0Qk6yNSgx8ZLb_imgpsh_fullsize.jpg" style="display: block; width: 100%; height: auto; margin-left: auto; margin-right: auto;"></div><div align="center">' + page + '</body></html>', 'review2.html');

}

1 个答案:

答案 0 :(得分:0)

我不确定网格库(例如离子或引导程序)在哪里

functions.database.ref('/users/{randomid}/{uid}')