6

複数の .jpg ファイル (デバイスのカメラを使用して撮影) を 1 つの .pdf ファイルに変換したいと考えています。iText、mupdf、PDFjet、pdjBox などの多くのツールを見ました。

もっと簡単なものはありますか?(Android に対応した API のようなものですか?)

ありがとう。

4

1 に答える 1

5

iText Library を使用してテキストを pdf に変換します。これを使用して、画像を 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();
   }
}
于 2013-04-01T13:33:49.223 に答える