Hi,
I have a pdf created with Adobe Acrobat 9, I am trying to access the
alternate text for images of this document, but always appears as null.
This is the code I'm using:
PdfReader reader = new PdfReader("c:\\tmp\\textoAlternativo.pdf");
for (int i = 0; i < reader.getXrefSize(); 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) {
if (pdfsubtype.toString().equals(PdfName.IMAGE.toString()))
{
byte[] img = PdfReader.getStreamBytesRaw((PRStream)
stream);
Image img1 = Image.getInstance(img);
System.out.println("alt1 "+img1.getAlt());
System.out.println("alt2 "+stream.get(PdfName.ALT));
}
}
}
}
}
Thanks,
Juan Antonio Mayol
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
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/