title: Save bytes to a pdf file and zip it
body: <p>I am trying to save bytes[] data in a pdf and zip it up. Everytime I try, I get a blank pdf. Below is the code. Can anyone guide me what am I doing wrong?</p>
  
  <pre><code>byte[] decodedBytes = Base64.decodeBase64(contents);
  ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream("c:\\output\\asdwd.zip")));
                      //now create the entry in zip file
  
  ZipEntry entry = new ZipEntry("asd.pdf");
  zos.putNextEntry(entry);
  zos.write(decodedBytes);
  zos.close();    
  </code></pre>
  
  <p>This is what I am following </p>
  
  <p>To obtain the actual PDF document, you must decode the Base64-encoded string, save it as a binary file with a “.zip” extension, and then extract the PDF file from the ZIP file.  </p>