Op 25/01/2011 20:15, Anthony Webster schreef:
> Hello,
>
> I'm having some trouble with images. When I insert JPEGs into PDFs they
> always come out stretched and thus pixelated. This happens with any JPEG
> I care to use. Am I doing something wrong (I can't see what my example
> case is so simple)?
>
> public static void main(String[] args) throws Exception {
>           Document document = new Document();
>           PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("test.pdf"));
>           document.open();
>           document.add(new Jpeg(new File("test.jpg").toURL()));
>           document.close();
> }

Using the Jpeg constructor instead of Image.getInstance() is somewhat 
strange, but it should be correct.
I think your problem is that you should scale your image down.
Note that iText doesn't change the number of pixels.

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to