I am creating a shipment from Amazon and getting a proper response file back.
But I need to get a carrier label in PNG format which is not so bad but I'm having issues with the Gzip process.
The Developer Guide from Amazon states:
- Decode the Base64-encoded string.
- Save the decoded string with a .gzip extension
- Extract the PDF/PNG or ZPL File from the GZIP File.
So Step 1 and 2 I kind of did but the file in step 3 isn't a proper PNG or similar.
Here is my code:
static void Main(string[] args)
{
byte[] data = Convert.FromBase64String("Base64 String");
using (FileStream fs = new FileStream(@"G:\Label.PNG.gzip", FileMode.CreateNew))
{
using (GZipStream zipStream = new GZipStream(fs, CompressionMode.Compress, false))
{
zipStream.Write(data, 0, data.Length);
}
}
}