Re: [iText-questions] BaseFonts.getDocumentFonts crashes

2010-03-20 Thread Juan Antonio de la Puente
Thanks, Paulo. Now it behaves like my modified version, i.e,. it lists only 
some of the fonts:

  $ listfonts 3469.pdf 
  QTRGMG+Arial-BoldMT
  IAJVTI+ArialMT

Where the full list should be much longer:

  QTRGMG+Arial-BoldMT   
   GFNNIT+CMTT8  
   JEFAMC+CMTI8  
   MPZVKG+CMR6   
   FNBQTC+CMTI10 
   RPBMZT+CMBX10 
   XQSMYX+CMMI8  
   VLZLUJ+CMMI12 
   RJYCLB+CMR10  
   VBWGVW+CMBX12 
   VPWRDP+CMR7   
   SDVCAT+CMSY7  
   LBQTEY+CMR8   
   IAJVTI+ArialMT
   GFAWRG+CMSY10 
   AZDNJY+CMSS10 
   RSOCLK+CMSSI8 
   OJXOVL+CMSSBX10   
   TMCDBM+CMSY8  
   NQQKKG+CMSS8  
   DQLGMD+Helvetica-Oblique  
   FDVTQC+Helvetica-Bold 
   ZLWAXE+Helvetica  
   VBMYEH+Helvetica  
   XIWTIM+CMTT10  
 

The same happens with other files, 

Best wishes,
-- Juan


 Fixed in the SVN.
 
 Paulo
   - Original Message - 
   From: Juan Antonio de la Puente 
   To: itext-questions@lists.sourceforge.net 
   Cc: Paulo Soares 
   Sent: Friday, March 19, 2010 11:43 AM
   Subject: Re: [iText-questions] BaseFonts.getDocumentFonts crashes
 
 
   Hi,
 
   The attached file fails with both the itext version of 
 BaseFont.getDocumentFonts and the modified version by me (include in the test 
 program, also attached). With the itext version the only result I get is 
 
   listfonts 3469.pdf 
   null
 
   and with the modified version I get
 
   $ listfonts 3469.pdf 
   QTRGMG+Arial-BoldMT
   IAJVTI+ArialMT
 
   which only includes the TrueType fonts in the file. The full list, obtained 
 with a program based on a previous version of getDocumentFonts, should be:
 
   QTRGMG+Arial-BoldMT   
   GFNNIT+CMTT8  
   JEFAMC+CMTI8  
   MPZVKG+CMR6   
   FNBQTC+CMTI10 
   RPBMZT+CMBX10 
   XQSMYX+CMMI8  
   VLZLUJ+CMMI12 
   RJYCLB+CMR10  
   VBWGVW+CMBX12 
   VPWRDP+CMR7   
   SDVCAT+CMSY7  
   LBQTEY+CMR8   
   IAJVTI+ArialMT
   GFAWRG+CMSY10 
   AZDNJY+CMSS10 
   RSOCLK+CMSSI8 
   OJXOVL+CMSSBX10   
   TMCDBM+CMSY8  
   NQQKKG+CMSS8  
   DQLGMD+Helvetica-Oblique  
   FDVTQC+Helvetica-Bold 
   ZLWAXE+Helvetica  
   VBMYEH+Helvetica  
   XIWTIM+CMTT10  
 
   It looks like the font dictionaries are not properly read. Any ideas?
 
   -- Juan
 


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
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/


[iText-questions] BaseFonts.getDocumentFonts crashes

2010-03-18 Thread Juan Antonio de la Puente
Hi,

I have found that BaseFonts.getDocumentFonts throws a null pointer exception 
with some PDF files. I have traced the exception to the end of the 
recourseFonts method, in particular line 1449 of the BaseFonts source file:

1446   PdfDictionary xobj = resources.getAsDict(PdfName.XOBJECT);
1447if (xobj != null) {
1448for (Object element : xobj.getKeys()) {
1449recourseFonts(xobj.getAsDict((PdfName)element), hits, 
fonts, level);
1450}
1451}

It seems that xobj.getAsDict((PdfName)element returns a null value in some 
cases. I have changed the above code as follows:

PdfDictionary xobj = resources.getAsDict(PdfName.XOBJECT);
if (xobj != null) {
for (Object element : xobj.getKeys()) {
PdfDictionary dict = xobj.getAsDict((PdfName)element);
if (dict != null) recourseFonts(dict, hits, fonts, 
level);
}
}

and it works. Anybody has had the same problem? 

-- Juan




--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
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/