2.4 Print Label
This section will show how you can print the label by using the API. The label in byte array is encoded in base64 string, the user needs to decode it back to byte array value and save the value as a file with *.pdf extension. User can pass in multiple HawbNo in order to receive several labels in one PDF file.
Parameters
Shipment Configuration
These field are used to notify the API which format of label need to be printed in PDF.
No. | Parameter | Data Type | Mandatory | Description |
---|---|---|---|---|
1 | LabelSize | Enum | Yes | Indicate what size need to use to create the label. |
2 | LabelFormat | Enum | Yes | Indicate the format of the label. |
// Values of LabelSize
// If you are using SOAP, use enumeration as value.
// If you are using JSON, use numeric number as value.
// If in doubt, select Inch_6x4 as label size.
public enum LabelSize {
Cm_10x10 = 0,
Inch_6x4 = 1, // This API only support 6x4 inch label size for temporary.
A4 = 2
}
// Values of LabelFormat
// If you are using SOAP, use enumeration as value.
// If you are using JSON, use numeric number as value.
// If in doubt, select Pdf as label format
public enum LabelFormat {
Pdf = 0, // This API only support PDF format for temporary.
Zpl = 1
}
Ramarks:
- This API only support 6x4 inch label size for temporary.
- This API only support PDF format for temporary.
Example:
Label Parameter
No. | Parameter | Data Type | Length | Mandatory | Description |
---|---|---|---|---|---|
1 | ShipmentsCredentials | ShipmentsCredentials | Yes | Refer to section 1.2 | |
2 | ShipmentsConfiguration | ShipmentsConfiguration | Yes | Refer to Shipment Configuration | |
3 | TrackReport | Enum | Yes | List of available report provided by the api. | |
4 | LabelType | Enum | Yes | Label type choices, user can choose whether LWE label or Carrier label only, or print both the label together. | |
5 | HawbNo | String[] | 50 | Yes | Hawb No. of shipment |
// Values of LabelSize
// If you are using SOAP, use enumeration as value.
// If you are using JSON, use numeric number as value.
// If in doubt, select Label as track report.
public enum TrackReport {
Label = 0,
CheckList = 1,
CommercialInvoice = 2,
ShipmentsSummary = 3,
ShipmentsSummary_CSV = 4,
ShipmentsSummary_Excel = 5,
AUPostManifest = 6
}
// Values of LabelFormat
// If you are using SOAP, use enumeration as value.
// If you are using JSON, use numeric number as value.
// If in doubt, select LWELabel as labl type
public enum LabelType {
BothLabel = 0,
LWELabel = 1,
CarrierLabel = 2
}
Example:
LabelParameter _par = new LabelParameter();
_par.ShipmentsCredentials = _credentials;
_par.ShipmentsConfiguration = _config;
_par.TrackReport = TrackReport.Label;
_par.LabelType = LabelType.BothLabel;
_par.HawbNo = new string[2]
_par.HawbNo[0] = "344010500000151";
_par.HawbNo[1] = "344010500000125";