For this week's Technical Tuesday, I will be explaining how you can automate batch printing of shipping labels using Acumatica.
Acumatica Environment: 5.30.2233
Acumatica Data: SalesDemo demo data from partner portal.
Businesses have different processes for printing shipping labels. Even the same business can have different processes depending on the priority of the shipment and the volume of business.
- One at a time: the person who packs the order immediately prints the postage and affixes it to the package for mailing.
- Batch printing: picking and packing functions are performed and handed off to a specialist who does the shipping. The shipping manager needs to print a batch of labels, inspect/seal the boxes, and affix a label.
Companies that ship a large volume of similar orders will benefit from batch processing.
In this article we review how to automate a batch printing process. In this scenario we have several boxes that have been picked and packed with standard stock items. The weight for the boxes and stock items is accurately tracked in Acumatica and available on the shipping document. A scale is not required because the same items and packaging are used for several orders.
As the shipping manager we need to print a batch of labels for the confirmed orders.
Acumatica does NOT print directly to a printer. Acumatica creates files that can be printed. The local computer being used to access Acumatica is responsible for sending the files to the printer. In this article we discuss:
- How Acumatica creates the files to be printed.
- How to configure your local computer to automatically print the files.
To implement batch processing, we need to do the following:
- Configure automatic packaging in Acumatica
- Configure carriers (UPS, USPS, FedEx) to return labels in a format supported by your printer
- Create a batch file on your local machine (the one you will print from) that when called will send a file to a USB or network printer
- Associate the file extension returned by carriers in step 2 with the batch file that you created in step 3 in Microsoft Windows. By doing this, when you open a file, it will call your batch program, which will send the file to the printer instead of displaying it using an application in Windows.
- Print labels by selecting Action > Print Labels from the batch processing screen in Acumatica.
Step 1: Configure Automatic Packaging in Acumatica
This step is not required, but makes it easier to process orders sent by common carriers. If you are using the SalesDemo data, all these steps have already been completed for you.
Turn on the automatic packaging feature in the ‘Enable/Disable Features’ screen.
Create packages in the ‘Boxes’ screen. The boxes can be generic or correspond to a specific carrier. The boxes in the SalesDemo are shown below.
Link Packages to Carriers
Associate boxes with a specific carrier on the ‘Ship Via Codes’ screen. This step allows you to assign specific boxes to specific carriers. Carriers are very specific about what types of boxes they accept for specific services. The ‘small’ box in the SalesDemo data is correctly sized for UPS and USPS, but does not work for FedEx.
The UPS screen is illustrated below.
Setup Automatic Packaging for your Stock Items
To assign the appropriate packaging, all stock items should include a weight, volume, and eligible boxes. The automatic packaging option needs to be turned on. An example of this in the SalesDemo data is shown below.
Step 2: Configure carriers to return the type of label supported by your printer
On the ‘Carriers’ screen, ensure that each carrier is set to return the specific type of label you want to print. In the example below, you can see that FedEx supports a wide variety of label formats.
I need to define a file type that is supported by my carrier and is directly printable. For this article, I’m using a laser printer, so PDF is the best option. If you are using a thermal printer, you would select ZPL or EPL.
Acumatica performs different actions depending on the type of file that is opened.
- Creates File. If the label file information is a thermal printer file (i.e. directly printable), then Acumatica merges the labels, creates one file, and associates it with a URL. After the file is created, Acumatica opens the URL with the browser and the file is automatically opened using the default program.
- Default file types: zpl, epl, dpl, spl, starpl, pdf
- Builds Report. If the file is not a thermal printer file, then Acumatica creates a report (SO.64.50.00) that contains all of the labels that need to be printed. The user can then open this using the associated program type and print the batch file.
- Default file types: all others
The logic for determining whether your file is directly printable is determined by the IsThermalPrinter() method in SO.SOShipmentEntry.
In order to get your file to automatically print, your file type must equal one of the settings above. If it does not, Acumatica will create a report which can be opened and printed.
Step 3: Create a print batch file
This step involves knowledge of your operating system to create a batch file that will send a file directly to a printer. In this example I am using Windows 8.1 with a network printer.
The instructions for creating the batch file are located within the Acumatica help files. Navigate to Help > User Guide > Sales Orders > Configuring Integration with Carriers > To Set Up Printing of Carrier Labels on a Thermal Printer.
I will use Notepad to create a batch file.
1. In Notepad, type the following text:
print /d:\ServerNamePrinterName %1
2. Replace ServerName with the name of your network server.
3. Replace PrinterName with the name of your network thermal printer.
4. Save the file as PrintLabels.bat to the appropriate location. Make sure that you select All Files for the Save as Type action.
In my case I am using a network printer so I used my PC name (find your PC name at Control Panel > System and Security > System) as my ServerName and I setup printer sharing (see appendix 1) and replaced the PrinterName with a share name, so my file consisted of this single line:
If you want to use a USB printer, then use the following instructions for creating your batch file.
1. Open Notepad, and type the following text:
Net use LPT2: \%ComputerName%SharedPrinterName
Copy %1 LPT2
Net use LPT2: /Delete
2. Replace SharedPrinterName with the shared printer’s actual name. Do not change%ComputerName%; the system will replace it automatically with your computer name.
3. Save the file as PrintLabels.bat to an appropriate location. Make sure that you select All Files for the Save as Type action.
Step 4: Associate the file extension with the batch file
This step changes your Microsoft Windows default actions when you open a particular type of file. When you open your print file type, you want to call/open the batch file you just created instead of opening the image in some other program.
In my case, I associated the .pdf extension with my batch file. I did this by searching for file association in windows and opening the “change the file type associated with a file extension” option.
Now each time I open a .pdf file on my computer, it will automatically open the PrintLabels.bat file which will send the document to the printer. So, when Acumatica is running on my computer and it opens a file, it will automatically print on my printer.
Note: sometimes your browser may have a separate plug-in to open PDF files. If this is the case, your browser will open the PDF instead of requesting the operating system to do it.
Step 5: Print labels using the batch process screen
After everything is configured, you simply process a few orders by doing the following:
- Create sales orders and select a shipping carrier
- Create shipments
- Confirm shipments (verify data in the Packages tab on your shipping document)
- Process shipments, Action > Print Labels (see screen shot below)
If everything is configured correctly, the batch of labels (2 in my case) should be printed directly to your printer.
APPENDIX: Setting up printer sharing
To setup printer sharing (http://superuser.com/questions/477895/printing-from-windows-7-command-line):
- Open Devices and Printers
- Right click your printer and select Printer Properties
In the Sharing tab select the option to share and assign a name as illustrated below.
Subscribe to our bi-weekly newsletterSubscribe
Get Acumatica Blog email updates as newsletters delivered bi-weekly to your inbox. Convenient!
Our promise to you:
1. We will never give your e-mail address to anyone else for any reason.
2. You can opt-out at any time.
Signing up for newsletters indicates you agree with our terms of service
If you decide that you no longer want to receive a newsletter, you can unsubscribe by clicking the "Unsubscribe" link, located at the bottom of each newsletter.