How to convert jpg to pdf in Android java

I want to convert several .jpg files (taken using the deviceโ€™s camera) to an ONE.pdf file. I have seen many tools like iText, mupdf, PDFjet, pdjBox.

Is there something simpler? (like an android ready API?)

Thank.

+5
source share
1 answer

using iText Library to convert text to pdf. Use this to convert your image to pdf.

import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class imagesPDF
{     
    public static void main(String arg[])throws Exception
    {                  
        Document document=new Document();
        PdfWriter.getInstance(document,new FileOutputStream("YourPDFHere.pdf"));
        document.open();
        Image image = Image.getInstance ("yourImageHere.jpg");
        document.add(new Paragraph("Your Heading for the Image Goes Here"));
        document.add(image);               
        document.close();
   }
}
+5
source

All Articles