<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="generator" content=" {{ metadata.generator }}">
  <title> {% block page_title %} Page {% endblock %} </title>
  <style>
    body {
      font-family:  {{ options.fontname }};
      background-color:  {{ options.bgcolor.html }};
    }
    /* Canvas size based on DIN 823 / DIN 6771 / EN ISO 5457 */

    #frame {
      position: relative;
      border: 0.35mm solid black; /* line weight based on DIN 15 */
    }

    .A4 { /* portrait */
      width: 180mm;
      height: 277mm;
    }

    .A3 { /* landscape */
      width: 390mm;
      height: 277mm;
    }

    .A2 { /* landscape */
      width: 564mm;
      height: 400mm;
    }

    table, td, th {
      border: 0.35mm solid black; /* line weight based on DIN 15 */
    }

    table {
      padding: 0;
      border-bottom: 0;
      border-right: 0;
      border-spacing: 0mm;
    }

    td, th {
      border-top: 0;
      border-left: 0;

      overflow: hidden;
      /* display: inline-block; */
      white-space: nowrap;
      font-size: 2.8mm;
    }

    {% set bottom_rows = options.titleblock_rows + 1 %}

  </style>
  {% block extra_head_style %}
  {% endblock %}
  <style type="text/css" media="print">

    @page {
      size: {{ metadata.template.sheetsize.value }} {{ metadata.template.orientation.value }};
      margin: 0;
    }

    #page {
      margin-top: 10mm;
      margin-left: 15mm; /* TODO: maybe scale this value depending on sheetsize */
    }

  </style>
</head>

<body>
  <div id="page">
    <div id="frame" class={{ metadata.template.sheetsize.value }}>
      {% block frame_content %} {% endblock %}
      {{ titleblock }}
    </div> <!-- /frame -->
  </div> <!-- /page -->
</body>
</html>
