6

I want to convert several .jpg files (taken using the device camera) to ONE .pdf file. I saw a lot of tools like iText, mupdf, PDFjet, pdjBox.

Is there something more simple? (like an API ready for android?)

Thanks.

0

1 Answer 1

5

using iText Library to convert the text to pdf. Use this to convert 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();
   }
}
3
  • and how do i add multiple images, each image in a seperate page..?
    – Ofer Segev
    Apr 11, 2013 at 8:59
  • Hey @Nathan, I have used your code to convert .jpg file to pdf. But the problem is that I am getting only a part of my image in Pdf document while my image is fully stored in the device. Can you please help me with that. Jan 30, 2015 at 11:31
  • its a bit urgent. If you can help. So I can accept your answer. Jan 30, 2015 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.