title: Convert Base64 into PDF without converting it into an Image in JAVA
body: <p>I've done converting PNG to PDF using itext. 
  How can i convert BASE64 into a PDF File, how can i achieve this.</p>
  
  <pre><code>//b64Image contains base64code from html2canvas, this code is for converting
   base64 to png 
  String b64Image=request.getParameter("img_val");
  
  b64Image = b64Image.replace("data:image/png;base64,", "");
  b64Image = b64Image.replace(" ", "+");
  
  byte[] imageByte;
  String path = "C:\\Users\\P.Balraj\\Desktop\\Screenshot.png";
  BASE64Decoder decoder = new BASE64Decoder();
  imageByte = decoder.decodeBuffer(b64Image);
  File outputfile = new File(path);
      BufferedOutputStream stream = new BufferedOutputStream(
          new FileOutputStream(outputfile));
  stream.write(imageByte, 0, imageByte.length);
  stream.flush();
  stream.close();
  </code></pre>
  
  <p>Thank you </p>