Forcing a page break for printing 2x3 picking tickets
Hi! I'm creating a custom template for printing 2x3 order picking labels for each item and one 'master ticket' with the order number, info and barcode- using a template that runs per order (so an order based template rather than an item based template)
I've got most of the information pulling in, but I need to force a printing page break after each item to keep to label formatting well aligned with the 2x3 thermal printer.
Is it possible to insert a page break within a template?
I'll include the the current template code below if that helps to clarify what I'm looking for.
Thanks!
-Jeff
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sw="http://www.interapptive.com/shipworks" extension-element-prefixes="sw">
<!-- Imports -->
<xsl:import href="System\Snippets" />
<xsl:output method="html" encoding="utf-8" indent="yes" />
<!-- Start of template -->
<xsl:template match="/"><xsl:apply-templates /></xsl:template>
<xsl:template match="ShipWorks">
<!-- Width defined by the template PageSettings -->
<xsl:variable name="pageWidth" select="concat(Template/Output/ContentWidth, ' in')" />
<!-- Default font. Specified as a variable since GMail and Outlook behave differently. -->
<xsl:variable name="pageFont" select="'font-family: Arial; font-size: 8pt;'" />
<!-- These styles are used on multiple td's so to avoid copy\paste errors they are defined once here. We have to do this since GMail doesn't support <style> in the <head>. -->
<xsl:variable name="orderDetailHeaderStyle" select="'border: 1px solid dimgray; background-color: #F3F3F3; font-weight: bold; padding: 3px;'" />
<xsl:variable name="orderChargeStyle" select="'white-space: nowrap; text-align: right; padding: 1px 8px 3px 16px;'" />
<html>
<head>
<title></title>
<style>
body, table { <xsl:value-of select="$pageFont" /> }
</style>
</head>
<body style="{$pageFont}">
<xsl:variable name="orderCount" select="count(Customer/Order)" />
<xsl:if test="$orderCount = 1">
<xsl:variable name="order" select="Customer/Order[1]" />
<!-- Line Items -->
<table>
<xsl:for-each select="$order/Item">
<tr>
<td>
<img src="b96bfae8.png" shipworksid="1176307030" importedFrom="BlackLogo.png" height="17" width="137"></img>
<br></br>
<font style="font-size:18pt; font-weight:bold;">#<xsl:value-of select="//Order/Number" /></font>
<br> </br>
<font style="font-family:Free 3 of 9; font-size:32pt; font-weight:normal;">*<xsl:value-of select="//Order/Number" />*</font>
<br></br>
<xsl:value-of select="sw:ToShortDate($order/Date)" />
</td>
<tr>
<td>
<!-- Shared Snippet -->
<xsl:call-template name="OrderItemCode">
<xsl:with-param name="item" select="." />
</xsl:call-template>
</td>
</tr>
<tr>
<td>
<xsl:value-of select="Name" />
</td>
</tr>
<tr>
<td>
<xsl:value-of select="Quantity" />
</td>
</tr>
</tr>
<!-- Displays any item attribuets that may exists -->
<xsl:for-each select="Option">
<tr>
<!-- <td>
<xsl:value-of select="Name" />:
</td> -->
<td>
<xsl:value-of select="Description" />
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
<br />
<!--
This is the end of the test ensuring a single order
-->
</xsl:if>
<!-- If there is not just a single order its an error -->
<xsl:if test="$orderCount != 1">
<p>
This template is designed to be per-order. There are currently
<xsl:value-of select="$orderCount" /> orders in the XML input source.
</p>
<p>
Please adjust the template settings to be processed per-order.
</p>
</xsl:if>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
-
Hi Nathan- thanks for your quick reply and your help.
I tried it as css
@...@media print {
footer {page-break-after: always;} }Then creating a footer element where I wanted the break... but I may have formatted the style incorrectly...
I was also going to try <div style="break-after:page"></div> where needed the break.
I will try this again to confirm that I've got the syntax and placement correct.
Thanks!
-Jeff
Please sign in to leave a comment.
Comments
3 comments