 Welcome to the next session. Kevin will be speaking about implementing a harmonized shipping label generator. So who in this room knows what a harmonized shipping label is? He's not in the room and I'm also not sure if he knows it. Yes it's post delivery related. Yeah so let me just say a couple of things how this happened. So as you know SysmoCom operates the the web shop which ships various things like SIM trays, SIM cards and and other bits and pieces, duplexes. And of course we are registered as a business customer with the German Postal Service where we I don't know how many hundreds of shipments we do a year probably something like 300, 500 or whatever. And suddenly after first of January this year they refused accepting our international shipments. So we went there and no no no you cannot ship this way anymore. So all basically everything had changed from 1st January 2019 and they did not notify the business customers that there would be any kind of changes in shipping. So you couldn't you couldn't deliver the shipments anymore as usual because now there's new products it's not a registered letter anymore but it's Waren Post International and Waren Post is not Waren Brief and is also not Waren Sendung and Waren Post International distinguishes between whether you send inside the EU or outside the EU and there applies that in some situations and not in some others and you cannot combine it with this option or with another option and anyway it's an entire nightmare but that having put that aside also they very clearly stated that you can so the way how we generate the shipping label so far is we basically use an API of the German Postal Services to upload the address information and the the weight of whatever the type of product that we want like we want a registered letter for €4.20 and then they return basically a QR code and the address label which we print on on a label printer and put it on the envelope that gets shipped. So the actual PNG image of what is printed is generated by a German Post. We just print it on the label printer and we stick the label on the envelope and this API continued to work after January 1st but German Post said no you cannot use that label that we generate. It's like what you know you're generating that label and we are not permitted to use that label that you generate. No but you now must create a label that adheres to the harmonized shipping label specification of the world post organization and here is a I don't know 27 or no how many pages do you know? It's pretty light yeah. Yeah it's like a 30 or whatever 20 page document that tells you exactly at which millimeter at which position which line has to be printed and so on and you have to generate that label yourself. German Post does not generate that label and in addition to that you also need to use a new API that is completely unrelated to the existing API to upload the customs information about each shipment where you state like the information that you write on the CN22 label like oh this is I don't know some electronics device for $20 and there is this and that and that. That needs to be sent prior to shipping the shipment in electronic form according to this new API but that's out of scope for the presentation today and Kevin will focus on the harmonized shipping label. The fun part if I may add that before we look at the actual shipping label is we continue to ship without that shipping label and it just works and I actually found out that in some developer manual for some whatever other API they stated that yeah they recommend to use this new harmonized shipping label to guarantee a smooth delivery of the letter particularly with foreign postal services and it might become mandatory from 1st of January next year. So actually right now you can continue to ship that way. Let's see if it actually changes 1st January next year but Kevin thought he could do something to make us prepared for that eventual new shipping label that everybody has to generate. So yeah this is a last submission because I didn't know if does it have to do with communication but yes it is mobile communication who post-based it still works so still fits Osmo-com and also I like emails so I hate emails but I like having receiving my AliExpress gadgets so why not spend time of it. So this is the origin how I told everything about it and I decided why not because I love vector graphics and I love when everything is very well defined with the millimeter exactly so I think I'm ready to become German and I started trying to find where really the specification is I didn't really find something but the German post the Deutsche Post gives you a light father and it looks like this is full screen so it doesn't work this is the document and it's 32 page exactly and this is in in German only but it has like he said everything you need this is how the shipping label looks like in the end is it's an A6 format and you have the from you have the tool you have the barcode which is also standardized all this little information to see how to handle it and this is where you put your stamp and it even includes the CN22 for the CN22 part with all the measurements it says even how how long it is yeah it tells you which font to use and so on so I decided yeah let's implement it because there is none available this is what I did and this is actually the result you are you're looking at this is how it looks like and it is a web page which is self-contained and everything you write as you can see whenever I change something it change or everything I write here is immediately written here I can also enable or disable the CN22 and everything is done in in SVG the only thing which I did not include is here the stamp because this is really specific to anyone but else you can set everything and then you can print and on the second page you have your shipping label which you can print in A6 and then it's done even even the barcode generation works so you can respect the EU format or intentional format for barcode generation there are some couple of exceptions where actually you don't use the CN22 but could add another label on something else I didn't include it here because it's exceptions and but the the rest is here the rest can be used and while implementing it I I kind of guessed why they don't give any tool because they probably don't have any tool and you see it from a couple of points whenever you you look at the at the things let's go on this page for example this is so yeah this is for the CN22 if you look at it they don't the text which they say must be specific is not in the example then there are some boxes also which are not in the examples and this is the example of the end format not this one anyone would work but let's take this one because there are no measurements and the text is not completely the same and also if you open it in Inkscape you can see that they just used something from a Spanish Spanish company and just added what they want to it and also if you measure the things they're not they don't they don't comply to the specification so the proportions are not the same one the text is not the same one and actually if you try to implement it and most specifically the CN22 part everything which they said you have to put on it with this font size it doesn't fit so and I think because of this they they don't have a tool yet so so last month I had a cross-continental flight so I implemented this in the in the cross-continental flight what works is really the label itself so yeah you can completely generate except the barcode with stamp which you could include later on barcode works it's a simple HTML page it's pure JavaScript no no other thing I'm not a web developer as you can see it is crude it is pure HTML there's no CSS I don't know how to do CSS I don't care I'm generate so it's vector you can do you can scale how much you want what doesn't work because I didn't have internet on the plane was that I couldn't have the library to generate a PDF out of it so the idea is tell so you can use it on a web page which is standalone you don't need any server anything because it's JavaScript but it would be also nice to have some kind of API where you get the PDF out of it in the end and can implement it how you want it so this is what is missing and which I'll probably implement in my next cross continental flight saving the SPC that's easy the API because it's not server-based I can only use get parameters so you just put the URL the problem is that there's a limitation of URL in most browsers 1024 characters so if you exceed this I don't know what happens I'll test it saving the PDF PDF converting SPC to PDF is a bit hard so I will use jQuery and CS PDF these were the two dependencies I have almost no choice I don't want to implement my PDF writer but this will only be for the generation of the PDF everything else is SVG so you can if you don't want this pity the thing you can still make control P or save the SVG yourself and print it and maybe include the stamp picture you could probably click choose and upload your stamp picture so it's immediately included the only thing which will not be there is the signature and the date because you have to to sign the CN 22 yourself everything it's then filled with the same same information and yeah that was a small talk and that that's actually it any questions about this shipping label yeah so the barcode stuff so did you implement it or did you just get some JavaScript library or something like that I implemented it myself it's it's JavaScript it's pure JavaScript I implemented it myself it's it's not too too hard what's funny is that the code which they use the code how to translate has a checksum but also the number which you add has also a checksum so there are two checksums in these things one on top of the other so do you care about other operating systems for the PDF saving because on Linux you can just click print and then save as PDF usually yeah that that's what you can do here but the idea is that you use some kind of API also so if you want for example integrated in order of whatever system then you have a PDF which you can transport anywhere you want without having a browser problem is you need to scale it to a correct size and I think if you let the browser print it the size will not always be very precise probably yeah so this is the size which are put in the SPG are really millimeters and this is really a six so whoever respects the units and the coordinates and putting in has the right size and I think probably this is a six I don't I didn't measure it but yeah the idea is also when you have the PDF you really have to a six PDF and nothing nothing else no letter no whatever with format you're using this is why and then because it's a web page you probably have to run it on the true node or something else but it's it's not too too hard of a restriction I was wondering whether you would want to put it on the license that would require the recipient of the package to receive the source code oh yeah yeah if it's a gpl how does it work it's still communication so yeah it's a good question add some hidden pixels to discover if people use it and yeah no license on that it's a small just don't know two kilobyte files for now there isn't a just a text file there's no license but there it will be I think I could already edit in one of the kids Osmo get repositories whoever wants to play with it but I still have to add the export to PDF and so on for now it's only a file and it's on no no repository are the glyphs in the section also vector based did you design them you do them by coordinates or they are all vector so yes the glyphs are all vector based I took them so they also give a vector package I had to correct them because not everything is right but even if you look so yeah I want everything vector based there's no nothing which is not vector based and the funny thing I've added here is the kilogram you could also change the total weight is it here probably are here the weight if you change the weight here it also changes the weight on the kilogram indication right here and you can only do that with vector so yeah everything which you see on here is vector probably the last thing which won't be vector is the stamp itself because I'm not sure that any company gives vector formats for for the stamps maybe maybe not I don't know but else everything is vector based and you can copy paste okay so when will you start working for German postal IT on the plane yeah I'm not sure how we are in terms of time we still have 15 minutes for question so I could say a bit more about the API madness if anyone was interested in that but yeah let's close the talk and then we can talk about the API madness yeah so I'll switch off the stream