Skip to content

GetPrintedLabels

Zsolt Kaveczki edited this page May 11, 2022 · 3 revisions

Generates parcel numbers and PDF document contains labels in byte array format. You can download/generate the labels only once, MyGLS doesn't support calling GetPrintedLabels multiple times for the same parcel.

use GuzzleHttp\Client as HttpClient;
use Webapix\GLS\Client;
use Webapix\Requests\GetPrintedLabels;

$account = new DefaultAccount();

$client = new Client(new HttpClient);

$request = new GetPrintedLabels();

// You can add multiple ParcelIds:
$request->addParcelId(123456789);
$request->addParcelId(987654321);

/** @var \Webapix\GLS\Responses\PrepareLabels $response */
$response = $client->on($account)->request($request);

if ($response->successfull()) {

    // get the pdf
    $response->getPdf();

}

You can set the label format:

$request->typeOfPrinter('Thermo');

Possible values: A4_2x2, A4_4x1, Connect, Thermo