Printing a DPD Label from API

2,732 views
Skip to first unread message

Jason hall

unread,
Jul 11, 2014, 8:17:17 AM7/11/14
to qz-p...@googlegroups.com
Hi,

I am after some help with the software. Basically I manage website in house and my employer wanted DPD integration for create shipments and printing labels.

All is integrated fine and the response I get back from the DPD API is in the below format as a json response. However json_decode (php) ends up outputting a blank page so just outputting the regular response results in the format below, however without linebreaks, just one continuous string. Can anyone help me please?

\M3000\c0000\e\O0220\f290\n\a\LD11PISIH12 
2911A0803340387DPD 
1911A1003800095Responsible Delivery - CO Neutral 
1911A08037802572 
2911A0603780354Sender 
2911A0603780346GEOPOSTUK LTD 
2911A0603780338ROEBUCK LANE 
2911A0603780330SMETHWICK 
2911A0603780322BIRMINGHAM 
2911A0603780314WEST MIDLANDS 
2911A0603780306B66 1BY 
2911A0603330303Phone:0121 500 2500 
2911A0603160354Account:304556 
2911A0603780293Delivery Address 
1911A1003640008GEOPOSTUK LTD 
1911A1003520008ROEBUCK LANE 
1911A1003400008SMETHWICK 
1911A1003280008BIRMINGHAM 
1911A1003160008WEST MIDLANDS 
1911A1003040008B66 1BY 
1911A1003040101United Kingdom 
151100003040247 
1911A0602950008Contact 
1911A0602860008Phone 
1911A0602610008Consignment 
1911A0602520008Ref 
1911A0602770008Info 
1911A0802930059MY CONTACT 
1911A08028400590121 500 2500 
1911A0602770059PLEASE DELIVER WITH NEIGH 
1911A0602690059BOUR 
1911A08025900595396871197

Tres Finocchiaro

unread,
Jul 11, 2014, 8:49:23 AM7/11/14
to Jason hall, qz-p...@googlegroups.com

Ate you sure there are no linebreaks?  If you are echoing this to a DOM element it may strip out the \n's, etc.

What might be more desirable is to just try qz.appendFile("http://somepage?param1&param2"); directly rather than trying to parse and process the response.

Just take caution to wait for qzDoneAppending() as the appendFile samples illustrate as to allow the same asynchronous behavior.

Is this message response proprietary to your company or provided by a well known 3rd party?  If there's something code-wise we can do to increase compatibility with a well known 3rd party, let me know and I can study the data stream and provide some convenience methods to ease the consumption of the data.

Jason hall

unread,
Jul 11, 2014, 9:05:24 AM7/11/14
to qz-p...@googlegroups.com
It gives spaces where the line breaks should be when echoed via php into a browser. If i set the header in php to json then it gives me linebreaks, however the top line according to DPD is supposed to have slashes which seem to get replaced with hidden characters when echoing.

It is a well known third party (DPD). Basically this is the code to get the label from the DPD API.

//get label
$url = "https://api.dpd.co.uk/shipping/shipment/".$shipid."/label/";
$content = json_encode($named_array);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER,
array("Content-type: application/json",
"Accept: text/vnd.citizen-clp ",
"GEOSession: ".$gsession."")
);
$json_response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 200 ) {
die("Error: call to URL $url failed with status $status, response $json_response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl)); 
curl_close($curl); 
echo $json_response;


The last line outputs to a browser for testing purposes with no line breaks. If I include "header('Content-type: application/json');" before the code, then it will give me line breaks but the top line looks like  M3000 c0000 e O0220 f290 n a LD11PISIH12 but it should be \M3000\c0000\e\O0220\f290\n\a\LD11PISIH12

If this is all to do with echoing then that's fine, however I am still lost how I get all that data into this qz thing. From what I understand I have to use the ESCP function and insert the string into qz.append() However from what I understand it has to be done line by line.


I'm lost, I've never dealt with anything like this before at all :(

Any and all help is very much appreciated.

Tres Finocchiaro

unread,
Jul 21, 2014, 8:46:08 AM7/21/14
to Jason hall, qz-p...@googlegroups.com
Yes, I'm lost too as the data you're providing doesn't match anything I'm familiar with.

Can you send me the raw data in a few different formats so that I can take a look at it?  Please feel free to send file attachments via email directly to tres.fi...@gmail.com

-Tres

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tres Finocchiaro

unread,
Jul 21, 2014, 8:46:35 AM7/21/14
to Jason hall, qz-p...@googlegroups.com

jc...@doc-net.com

unread,
Nov 20, 2014, 12:01:49 PM11/20/14
to qz-p...@googlegroups.com
Hi!

Have you found a solution?
I need to use the same format from DPD with a Citizien printer.

I haven't tried yet but it would be good to know if qz can handle this format or not.

Thanks!

Tres Finocchiaro

unread,
Nov 20, 2014, 1:24:57 PM11/20/14
to jc...@doc-net.com, qz-p...@googlegroups.com

Have you found a solution?

No, I think I was waiting to hear from you...   Did you responded to this question?
Can you send me the raw data in a few different formats so that I can take a look at it?  Please feel free to send file attachments via email directly to tres.fi...@gmail.com

 

Tres Finocchiaro

unread,
Jun 22, 2015, 10:15:58 PM6/22/15
to qz-p...@googlegroups.com, gesta...@googlemail.com
Status update.... We've recently had a client notify us that changing the HTTP header information to text/plain fixed this.

This particular client chose to use Content-Type: text/vnd.citizen-clp”

-Tres


Jozsef Cseh

unread,
Jun 26, 2015, 11:09:12 AM6/26/15
to Tres Finocchiaro, qz-p...@googlegroups.com, Jason hall
Hi Tres,

Thank you for the feedback. We found the same solution and it's working fine.
Right now I have another issue with printing a PDF label. I've got a completely blank label as a result. I also tried the latest plugin with QZ Tray.

I saw that there is a solution to print a PDF file base64 encoded. 
Can you help me how to this? I tried to base64 encode the source and send out an extra 
Content-Transfer-Encoding: base64
header but it doesn't seem to work.

Thank you



--
You received this message because you are subscribed to a topic in the Google Groups "qz-print" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/qz-print/6W6DHaxtLE0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to qz-print+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jozsef Cseh, Web Developer
Call: 0845 521 0444 / Webwww.docnet.nu
This message is private and confidential. If you have received this message in error, please notify us and remove it from your system. Doctor Net Limited t/a Docnet is a company registered in England and Wales. Registered number: 3303804. Registered office: Speakers House, 39 Deansgate, Manchester, M3 2BA

Tres Finocchiaro

unread,
Jun 26, 2015, 11:36:58 AM6/26/15
to jc...@docnet.nu, qz-p...@googlegroups.com, Jason hall
Try using plain text and using this syntax:

qz.append64("data:application/pdf;base64,Ck4KcTYw...")


Tres Finocchiaro

unread,
Jun 26, 2015, 11:37:41 AM6/26/15
to jc...@docnet.nu, qz-p...@googlegroups.com, Jason hall
Typo... 

qz.appendPDF("data:application/pdf;base64,Ck4KcTYw...")

Amin Aftabtalab

unread,
Nov 10, 2022, 4:05:12 PM11/10/22
to qz-print
Hi 

Does anyone of you know what is the general format language for Dpd label? 
Does Dpd supprting ZPL,DPL,EPL ? 

thx 

Tres Finocchiaro

unread,
Nov 10, 2022, 4:13:16 PM11/10/22
to Amin Aftabtalab, qz-print
I believe they support both PDF and ZPL as well as both 203DPI and 300DPI.

Which API are you using?  I found one for Romania and one for the Netherlands, so I'm not sure if they're redundant or regional services, etc.



The Netherlands documentation specifically states "Label in PDF format".

I would recommend reaching out to DPD support for more information.  

Administratorem danych osobowych jest Ekol Logistics Sp. z o.o. z siedzibą przy ul. Składowa 4, 62-023 Koninko
Więcej informacji można znaleźć w Klauzuli informacyjnej RODO.
REGON: 361049601, NIP: 9721253894, Numer KRS: 0000548871, Wysokość kapitału zakładowego: 500 000 pln. 
Sąd Rejonowy Poznań - Nowe Miasto i Wilda w Poznaniu, Wydział VIII Krajowego Rejestru Sądowego.

--
You received this message because you are subscribed to the Google Groups "qz-print" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qz-print+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qz-print/520f539f-5fd5-4acd-b0e7-efc013fbadfdn%40googlegroups.com.

Elif GÜLLAÇ

unread,
Feb 27, 2024, 1:25:48 AM2/27/24
to qz-print
Hi,
i'm trying to convert the bender html format to pdf, but the html gets corrupted during the convert process do you have any library suggestions that I can use for php 5.6, or can anyone get the etiekti as pdf

11 Kasım 2022 Cuma tarihinde saat 00:13:16 UTC+3 itibarıyla Tres Finocchiaro şunları yazdı:

Tres Finocchiaro

unread,
Feb 28, 2024, 12:39:14 PM2/28/24
to Elif GÜLLAÇ, qz-print
Hi,

Can you please explain in full what you are trying to achieve?

Reply all
Reply to author
Forward
0 new messages