Mailing Labels - Custom Sizes
Imports: 6

This report makes it easier to create custom label sizes. Plug in the measurements of your labels at the top, and format the contents. Make sure to include units in the measurements, with no space after the number. (You can use millimeters for metric sizes.)

Preview

Report Preview


<!-- Page Size (US-Letter, A4, etc) -->
{% capture pageSize %}
US-Letter
{% endcapture %}

<!-- Page Margin (Top Right Bottom Left) -->
{% capture pageMargins %}
0.5in 0.1875in 0.5in 0.1875in
{% endcapture %}

<!-- Label Height -->
{% capture labelHeight %}
1in
{% endcapture %}

<!-- Label Width -->
{% capture labelWidth %}
2.625in
{% endcapture %}

<!-- Labels Per Page -->
{% capture labelCount %}
30
{% endcapture %}

<!-- Space between columns -->
{% capture columnSpacing %}
0.125in
{% endcapture %}

<!-- Space between rows -->
{% capture rowSpacing %}
0in
{% endcapture %}


{% assign pageSize = pageSize | strip_newlines %}
{% assign pageMargins = pageMargins | strip_newlines %}
{% assign labelHeight = labelHeight | strip_newlines %}
{% assign labelWidth = labelWidth | strip_newlines %}
{% assign labelCount = labelCount | strip_newlines %}
{% assign columnSpacing = columnSpacing | strip_newlines %}
{% assign rowSpacing = rowSpacing | strip_newlines %}
{{ helpers.bootstrap_3 }}

<html>
  <head>
    <title>Avery Labels</title>
    <style>
      @media print { 
        body { margin: 0; padding: 0; }
      }
      @media screen { 
        body { margin:{{pageMargins}}; margin-right: 0 !important;  margin-bottom: 0 !important; }
      }
      @page { margin:{{pageMargins}}; margin-right: 0 !important;  margin-bottom: 0 !important; size: {{pageSize}}; }
      
      ul { margin: 0; padding: 0; }
      ul.labels li {
        margin: 0 {{ columnSpacing }} {{ rowSpacing }} 0;
        padding: 0;
        float: left;
        width: {{ labelWidth }};
        height: {{ labelHeight }} !important;
        display: block;

      }
      ul.labels li:nth-of-type({{- labelCount | plus: 1 -}}n+{{- labelCount | plus: 1 -}}) { page-break-inside: avoid;}
      
      
/*  FORMAT LABEL CONTENTS  */
        
      div.labelcontents {
        margin: 0;
        padding: 0.1in 0.1in 0 0.1in;
        width: 100%;
        font-size: 11pt;
      }
      
    </style>
  </head>


  <body>
    <ul class="labels">
      {% for person in people %}
      	<li>
          <div class="labelcontents">
            {{ person.name }}<br>
            {{ person.primary_address.street }}<br>
            {{ person.primary_address.city }} {{ person.primary_address.state }} {{ person.primary_address.zip }} 
          </div>
      	</li>
      {% endfor %}
    </ul>
  </body>
</html>