I want to insert a jpg image into a pdf. The image was created from a 
document that was scanned in. I am doing it this way:

    Document document = new Document(PageSize.LETTER, 0, 0, 0, 0);

    PdfWriter.getInstance(document, new FileOutputStream("C:\\test.pdf"));
    document.open();
    java.awt.Image scannedImage = 
Toolkit.getDefaultToolkit().getImage(filePath);
    com.lowagie.text.Image pdfImage = 
com.lowagie.text.Image.getInstance(scannedImage, null);
    pdfImage.scaleAbsolute(612f, 792f);
    document.add(pdfImage);
    document.close();

This works fine except that it creates a much larger file than the jpg 
inserted. The jpg size is 541 KB and the pdf ends up being 4.2 MB. How 
do I get the pdf to be smaller, or am I even doing this corectly?

-- 
Thanks,

Warren Bell


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to