This is the COMPLETELY WRONG WAY to find all fonts in a PDF.
You need to navigate down the "logical tree", starting at the /Catalog and then
going through the /Pages tree, finding all content streams, checking their
resources, etc.
Leonard
On 6/9/09 12:35 PM, "Christian Kirchhoff" <[email protected]>
wrote:
Hello,
I want to use iText to examine existing pdf files, not to create new ones.
While playing around with the ClimbTheTree example I had the feeling that the
functions mentiones in the subject to not work as I would expect them to work.
For example when I want to iterate through all objects and get all the font
dictionaries, I would do something like this:
PdfReader reader = new PdfReader("filename.pdf");
int i = 1;
while (reader.getPdfObject(i) != null) {
if (reader.getPdfObject(i).isDictionary()) {
PdfDictionary pdfDict = (PdfDictionary)
reader.getPdfObject(i);
if (pdfDict.isFont()) {
list.println("Font: " +
pdfDict.get(PdfName.BASEFONT));
}
}
i++;
}
But apparently isFont() always returns false. I'd rather have to check
pdfDict.get(PdfName.TYPE).equals("/Font")
But then what is the purpose of those isFont(), isPages() etc. functions?
Best regards,
Christian Kirchhoff
Editura Gesellschaft für Verlagsdienstleistungen mbH
Tempelhofer Damm 2 · 12101 Berlin
www.editura.de <http://www.editura.de>
AG Berlin-Charlottenburg · HR B 81823 · USt.Id. DE217180548
Geschäftsführer: Ralf Szymanski
--
Leonard Rosenthol
PDF Standards Architect
Adobe Systems Incorporated
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
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/