Thanks for replying still have some questions inserted. On Wed, Jan 21, 2009 at 1:31 AM, 1T3XT info <i...@1t3xt.info> wrote: > Ryan Wexler wrote: >> I am capturing images from a scanner and converting them into pdfs. I >> am having a couple problems. >> >> The main issue is that when I add the image to the pdf the edges of it >> go missing. > > As far as I can see your image is bigger than your page. > >> The bottom edge of the image is missing. Oddly it seems as if an >> empty area is appended to the top of the image. > > You're talking about the margin of the document, aren't you? > >> The right edge and >> left edges are missing. > > Correct, the image is too large for the document. > >> Here is the code I am using: >> PdfWriter.getInstance(document, >> new FileOutputStream("c:\\testpdfimg.pdf")); >> document.open(); >> com.lowagie.text.Image itextimage = >> com.lowagie.text.Image.getInstance("c:\\test.jpg"); >> document.add(itextimage); >> document.close(); > > You forgot to mention the line: > Document document = new Document(); > meaning you created an A4 page with margins of half an inch. > > Such a page is 595 x 842 pts. > Your image is 636 x 877 pts. > You have a 36pt margin, so you miss > 842 - 36 - 877 = -71 > and > 595 - 36 - 636 = -77 > So you are losing almost an inch in height, > and over an inch in width. > This was a bonehead mistake of mine, I didn't even think about page size. Changing the document to an A1 solves this problem.
>> Also when I tried creating the image directly from a BufferedImage >> which I pull from the scanner without first saving it as a jpg like >> so: >> com.lowagie.text.Image itextimage = >> com.lowagie.text.Image.getInstance(image, null); >> document.add(itextimage); >> >> Then the size of the pdf is almost 10 times as large. Why is that? > > The number of pixels is different, isn't it? I don't understand this. If I open the two documents in photoshop and do an image size it shows the exact same number of pixels. My question is thus: (1) I saved the image as a jpg and then (2) opened that jpg and inserted into the pdf. If I bypass step (1) then the pdf is 10 times as large, why is that? > >> Is there a way around it? > > Er... what is the question? ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ 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