title: base 64 png string to base 64 jpg using java or javascript
body: <p>I'm working on a project developed in Android with PhoneGap , we need to draw items on the screen and turn this data into pdf.</p>
  
  <p>To draw we are using html5 canvas element.</p>
  
  <p>To write pdf we are using the library "jsPdf."</p>
  
  <p>The problem is that, on Android, the method canvas.toDataUrl ('image / jpeg') always returns a string of "image/png" type but the jsPdf library only reads images in Base64-jpg format.</p>
  
  <p>I thought of two solutions:</p>
  
  <p>1) use some sort of "javascript encoder", which I found on the internet, but I could not find an active link, to transform the canvas in the Base64-jpg format string.</p>
  
  <p>2) create a plugin that "translate" the base64-png string into base64-jpg format.</p>
  
  <p>So....is there a way in javascript or java to make this "translation"?
  Or anyone know another way to realize what I have explained?</p>