iText can't downsample images.
Best Regards,
Paulo Soares
----- Original Message -----
From: "Eric Stephens" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, August 27, 2003 15:35
Subject: [iText-questions] iText images to 72 dpi
> First let me just say: "What an amazing piece of work!"
>
> Can you recommend the best way to use iText to create a PDF from an HTML
> file?
>
> I have been using iText to segment PDFs so that I can stream only
> certain pages to a browser. Because many of the PDFs started as
> scanned TIFFs they are quite large (20+ Meg). Even a page can be 500k.
>
> Is it possible to detect large bitmaps and down sample them to 72 dpi
> using iText?
> Here's the code.
>
>
> PdfReader reader = new PdfReader(PDFfile);
> // we retrieve the total number of pages
> int n = reader.getNumberOfPages();
> System.out.print(PDFfile + " has " + n + " pages. Start at page " +
> page0);
>
> // step 1: creation of a document-object
> Document document1 = new
> Document(reader.getPageSizeWithRotation(1));
> // step 2: we create a writer that listens to the document
> PdfWriter writer1 = PdfWriter.getInstance(document1, new
> FileOutputStream("/tmp/temp" + page0 + ".pdf"));
> // step 3: we open the document
> document1.open();
> PdfContentByte cb1 = writer1.getDirectContent();
> PdfImportedPage apage;
> int rotation;
> int i = page0-1;
> // step 4: we add content
> while (i < (page0+pages-1)) {
> i++;
> document1.setPageSize(reader.getPageSizeWithRotation(i));
> document1.newPage();
> apage = writer1.getImportedPage(reader, i);
> rotation = reader.getPageRotation(i);
> if (rotation == 90 || rotation == 270) {
> cb1.addTemplate(apage, 0, -1f, 1f, 0, 0,
> reader.getPageSizeWithRotation(i).height());
> }
> else {
> cb1.addTemplate(apage, 1f, 0, 0, 1f, 0, 0);
> }
> }
> // step 5: we close the document
> document1.close();
> _____
>
> Eric R. Stephens, <http://www.ericstephens.com/> Ph.D.
> [EMAIL PROTECTED]
> What the team needs to know now <http://www.knowledgebin.com/> !
> Founder and CTO
> 770-643-9297
> (fax)530-579-8924
>
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions