Obtaining labels from DM using just one URL

Printer-friendly version

One of the more common problems faced by the integrator relates to the actual production of labels. The DM system produces self-printing PDF files containing all the desired labels. A similar need is faced in most integration projects too. In amongst the changes released in DM 2.8, you can now access those labels directly using a single URL. That URL can take four important parameters (consignmentCode, orderNumber, printerType, and printerName).

You must provide either the consignmentCode or orderNumber. And you must provide the printerType parameter.

You can print supporting documentation (A4) just like normal labels, and that is indicated by the printer type.

This example will produce the labels for a particular consignment, and will put in the self-printing JavaScript so that Acrobat Reader will send it to a particular printer when it is opened:

http://dm.metapack.com/dm/ActionServlet?action=label&consignmentCode=DMC8712347234&printerType=label&printerName=\\printserver\zebra

And this one allows you to print the A4 documentation:

http://dm.metapack.com/dm/ActionServlet?action=label&consignmentCode=DMC8712347234&printerType=a4&printerName=\\printserver\laserjet

You can use multiple parameters too. This next example shows how to print the labels and then the A4 documentation for multiple consignments:

http://dm.metapack.com/dm/ActionServlet?action=label&consignmentCode=DMC8712347234&consignmentCode=DMC1876323312&printerType=label&printerName=\\printserver\zebra
http://dm.metapack.com/dm/ActionServlet?action=label&consignmentCode=DMC8712347234&consignmentCode=DMC1876323312&printerType=a4&printerName=\\printserver\laserjet 

 Similarly, the concept works for order number. This will produce the PDF for all the consignments in a specific order:

http://dm.metapack.com/dm/ActionServlet?action=label&orderNumber=ORDER827634&printerType=label&printerName=\\printserver\zebra

If you don’t specify the printer name, the default one (associated with the user’s cookie) will be used.

If using something like wget ("web get" on UNIX), you can wrap up the whole lot so that it first logs in and then redirects to the label production page:

wget -q --output-document=label.pdf "$URL/ActionServlet?action=login&userId=$USER&password=$PASSWORD&url=/dm/ActionServlet%3Faction%3Dlabel%26printerType%3Dlabel%26showErrors%3Dtrue%26printerName%3DNONE%26consignmentCode%3D$CONSIGNMENTCODE"

(Replace $URL, $USER and $PASSWORD and $CONSIGNMENTCODE as necessary)

That compete URL can also be used inside a browser.