Hi Bruno/Leo,
It's urgent task that I need to complete in coming two days :(
I need to extract all format image from pdf document. 
I tried with Bruno suggestion ImageXRefViewer.java class.

              PdfReader chartReader = new PdfReader("MyPdf.pdf");
                 for (int i = 0; i < chartReader.getXrefSize(); i++) {
                  PdfObject pdfobj = chartReader.getPdfObject(i);
                  if (pdfobj != null && pdfobj.isStream()) {
                    PdfStream stream = (PdfStream) pdfobj;
                    PdfObject pdfsubtype = stream.get(PdfName.SUBTYPE);
                    //System.out.println("Stream subType: " + pdfsubtype);
                    if (pdfsubtype != null &&
pdfsubtype.toString().equals(PdfName.IMAGE.toString())) {
                byte[] image = PdfReader.getStreamBytesRaw((PRStream)
stream); 
                Image image = Image.getInstance(imgBytes);
               using this image object I need to retrieve the image
height,width and dpi i.e.                   image.getDpiX();



Mike Marchywka-2 wrote:
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ----------------------------------------
>> Date: Mon, 30 Nov 2009 04:19:34 -0800
>> From: j
>> To: itext-questions@lists.sourceforge.net
>> Subject: Re: [iText-questions] extract the stamped image from pdf
>>
>>
>> Hi,
>> ImageXRefViewer will help us to extract images input stream from pdf
>> document.
>> After getting the image input stream I am able to create the instance of
>> only jpeg images are embedded in pdf document.
>>
>> Image image = Image.getInstance(imgBytes);
>>
>> For other formated images getting the error massage.
>>
>> java.io.IOException: The byte array is not a recognized imageformat.
> 
> Bruno or Leo may have an answer but it may also help if you can provide
> the first few bytes of your buffer to get
> some indication of what the image really is or if something
> else happened. I've gotten this in other contexts
> and the "image" was ascii html giving a human readable
> 404 response. Not sure what could happen in pdf. I've
> also had cases where the built-in image stuff isn't enough
> and exotic images types require you to find alt 
> libraries.
> 
>>
>> Please need your help to extract all formats images are
>> embedded/available
>> in pdf document.
>>
>>
>>
>> Bruno Lowagie (iText) wrote:
>>>
>>> jerry wrote:
>>>
>>>>hi,
>>>>
>>>> how to extract the stamped images from pdf using itext.i will be
>>>> very
>>>>thankfull to u if u Provide me a sample code.forgive me if this is a
>> repeated
>>>>question.
>>>>
>>> Not sure what you mean by stamped images.
>>> Images added with PdfStamper, yeah?
>>> Take a look at the ImageXRefViewer plug-in in the toolbox.
>>> http://itext.ugent.be/library/src/com/lowagie/tools/plugins/
>>> It has some code in the execute method that can be used
>>> to read images from PDF files.
>>> br,
>>> Bruno
>>>
>>> -------------------------------------------------------------------------
>>> Using Tomcat but need to do more? Need to support web services,
>>> security?
>>> Get stuff done quickly with pre-integrated technology to make your job
>>> easier
>>> Download IBM WebSphere Application Server v.1.0.1 based on Apache
>>> Geronimo
>>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>>> _______________________________________________
>>> iText-questions mailing list
>>> iText-questions@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/extract-the-stamped-image-from-pdf-tp6302287p26573800.html
>> Sent from the iText - General mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and
>> focus on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> 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
>> Check the site with examples before you ask questions:
>> http://www.1t3xt.info/examples/
>> You can also search the keywords list:
>> http://1t3xt.info/tutorials/keywords/
>                                         
> _________________________________________________________________
> Bing brings you maps, menus, and reviews organized in one place.
> http://www.bing.com/search?q=restaurants&form=MFESRP&publ=WLHMTAG&crea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day 
> trial. Simplify your report design, integration and deployment - and focus
> on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> 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
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
> 
> 

-- 
View this message in context: 
http://old.nabble.com/extract-the-stamped-image-from-pdf-tp6302287p26576835.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to