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.
To draw we are using html5 canvas element.
To write pdf we are using the library "jsPdf."
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.
I thought of two solutions:
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.
2) create a plugin that "translate" the base64-png string into base64-jpg format.
So....is there a way in javascript or java to make this "translation"? Or anyone know another way to realize what I have explained?