---------- hi ----------
From: Mostafa Shaeri <[email protected]>
Date: Sun, Aug 8, 2010 at 10:33 AM
Subject: help
To: [email protected]
hello.
i faced problem in my image extractor code. any suggestion appreciated.
i first get stream from pdf and check the object in that , if object is a
image i will save it.
the code is working properly and i can get all image in the pdf. but some
images is unusual because some texts on the image are hidden
(erased).!!!!!!!!
i am persian .excuse me for my bad english .thank you .
the code :
PdfReader reader = new PdfReader(pdf);
{
for (int i = 0; i < reader.XrefSize; i++)
{
PdfObject pdfobj = reader.GetPdfObject(i);
if (pdfobj != null)
{
if (pdfobj.IsStream())
{
PdfStream stream = (PdfStream)pdfobj;
PdfObject pdfsubtype = stream.Get(PdfName.SUBTYPE);
if (pdfsubtype != null)
{
// PDF Subtype OK
if (pdfsubtype.ToString().Equals(PdfName.IMAGE.ToString()))
{
//image found
// MessageBox.Show("0");
byte[] img = PdfReader.GetStreamBytesRaw((PRStream)stream);
if (img.Length >= 5 * 1024)
{
FileStream outp = File.Create(output +"\\img" + i.ToString() + ".bmp");
outp.Write(img, 0, img.Length);
outp.Flush();
outp.Close();
}
}
}
}
}
}
}
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
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/