> -----Original Message-----
> From: David Nielsen [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, February 10, 2003 16:16
> To: [EMAIL PROTECTED]
> Subject: RE: [iText-questions] Embedded fonts
>
> For what i can read in the PDF Reference (Third edition), the font
> desriptor
> is a dictionary.
> But when i try getting the fontdesriptor with:
>
> PdfDictionary dict = reader.getPageN(i);
> PdfDictionary pageResources =
> (PdfDictionary)reader.getPdfObject(dict.get(PdfName.RESOURCES));
> PdfDictionary fonts =
> (PdfDictionary)reader.getPdfObject(pageResources.get(PdfName.FONT));
> PdfDictionary fontsdescrip =
> (PdfDictionary)reader.getPdfObject(fonts.get(PdfName.FONTDESCRIPTOR));
>
> The last line retuns null.
>
'fonts' is a dictionary of names and fonts. The font descriptor is
not here yet.
> I tryed with:
>
> Set fontkeys = fonts.getKeys();
> Iterator fontIterator = fontkeys.iterator();
> while(fontIterator.hasNext()) {
> PdfDictionary font =
> (PdfDictionary)reader.getPdfObject(fonts.get((PdfName)fontIterator.next())
> );
>
This works. Now you have the font and can get the descriptor.
> System.out.println(font.isFont());
>
This will not workhere, only when creating content. What you have is
a generic dictionary that happens to be a font.
> }
>
> output:
> java.lang.NullPointerException
> at com.lowagie.text.pdf.PdfDictionary.isFont(Unknown Source)
> at mypackage5.FontsItext.<init>(FontsItext.java:26)
> at mypackage5.FontsItext.main(FontsItext.java:37)
>
> should'nt it be a Font ?
>
> and with:
> Set fontkeys = fonts.getKeys();
> Iterator fontIterator = fontkeys.iterator();
> while(fontIterator.hasNext()) {
> PdfDictionary font =
> (PdfDictionary)fonts.get((PdfName)fontIterator.next()); // Here
> System.out.println(font.isFont());
> }
> output:
> java.lang.ClassCastException:
> com.lowagie.text.pdf.PRIndirectReference
> at mypackage5.FontsItext.<init>(FontsItext.java:25)
> at mypackage5.FontsItext.main(FontsItext.java:37)
>
Use the other form. the work is done.
Best Regards,
Paulo Soares
> The botton line i have a PDF with a font in it that isnt embedded. and
> Acrobat fails when i open the file,
> replacing the text with ........
> i just need to know which fonts are used in the document and are they
> embedded or available, so i can tell before opening the file in acrobat if
> there are missing fonts.
>
> Regards,
> David
>
>
>
>
> -----Original Message-----
> From: Paulo Soares [mailto:[EMAIL PROTECTED]]
> Sent: 6. februar 2003 16:14
> To: '[EMAIL PROTECTED]'
> Subject: RE: [iText-questions] Embedded fonts
>
>
> Do:
>
> PdfDictionary dict = reader.getPageN(i);
> PdfDictionary pageResources =
> (PdfDictionary)reader.getPdfObject(dict.get(PdfName.RESOURCES));
> PdfDictionary fonts =
> (PdfDictionary)reader.getPdfObject(pageResources.get(PdfName.FONT));
>
> The values in fonts are the actual fonts. Get them with
> reader.getPdfObject() because most of them are indirect references.
>
> Best Regards,
> Paulo Soares
>
> > -----Original Message-----
> > From: Archangel [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, February 06, 2003 13:53
> > To: 'Paulo Soares'
> > Subject: RE: [iText-questions] Embedded fonts
> >
> > You say go to the fonts resources ?
> > i can do the:
> > PdfDictionary dict = reader.getPageN(i);
> > PdfObject pageResorces =
> (PdfObject)dict.get(PdfName.RESOURCES);
> >
> > but what type is the pageResorces then, its not a PdfDictionary, is it a
> > PdfResources, if so how do i get anything out of this when its Private.
> >
> > its not the pdf specs i dont undestand, i just cant se how the api is
> > doing
> > it.
> >
> > i cant find any examples in any posts in mailarchive or in the Tutorial.
> > You have any, im growing hair.
> >
> > Regards,
> > David
> > sorry.. i see i have used a wrong email address.
> >
> > -----Original Message-----
> > From: Paulo Soares [mailto:[EMAIL PROTECTED]]
> > Sent: 6. februar 2003 12:19
> > To: '[EMAIL PROTECTED]'
> > Subject: RE: [iText-questions] Embedded fonts
> >
> >
> > Page->Resources->Font
> >
> > > -----Original Message-----
> > > From: Archangel [SMTP:[EMAIL PROTECTED]]
> > > Sent: Thursday, February 06, 2003 11:13
> > > To: 'Paulo Soares'
> > > Subject: RE: [iText-questions] Embedded fonts
> > >
> > > Yes..
> > > But what i can read is that the FONT name is a Dictionary Object. and
> > not
> > > a
> > > Null Object,
> > > so shouldnt the PdfObject font = dict.get(PdfName.FONT); return a FONT
> > > Dictionary, it returns null, i cant see or undestand the why this
> > shouldnt
> > > be right
> > >
> > > Best Regards,
> > > David Nielsen
> > >
> > > -----Original Message-----
> > > From: Paulo Soares [mailto:[EMAIL PROTECTED]]
> > > Sent: 6. februar 2003 11:42
> > > To: '[EMAIL PROTECTED]'
> > > Subject: RE: [iText-questions] Embedded fonts
> > >
> > >
> > > Do you have the pdf reference (it's downloadable from
> > partners.adobe.com)?
> > >
> > > Best Regards,
> > > Paulo Soares
> > >
> > > > -----Original Message-----
> > > > From: Archangel [SMTP:[EMAIL PROTECTED]]
> > > > Sent: Thursday, February 06, 2003 10:43
> > > > To: 'Paulo Soares'
> > > > Subject: RE: [iText-questions] Embedded fonts
> > > >
> > > > I cant se so get this correct..
> > > > why does the font.isDictionary() throw a NullPointerException.
> > > > isnt it a PdfDictionary. or isnt it the way to go?
> > > >
> > > >
> > > > try {
> > > > PdfReader reader = new PdfReader("M2003-02-05_240.pdf");
> > > > for(int i = 1; i <= reader.getNumberOfPages(); i++) {
> > > > PdfDictionary dict = reader.getPageN(i);
> > > > PdfObject font = dict.get(PdfName.FONT);
> > > > System.out.println(font.isDictionary());
> > > > }
> > > > } catch(Exception e) {
> > > > System.out.println("Exception caught !");
> > > > e.printStackTrace();
> > > > }
> > > >
> > > >
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED]]On Behalf Of
> Paulo
> > > > Soares
> > > > Sent: 5. februar 2003 20:39
> > > > To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
> > > > Subject: RE: [iText-questions] Embedded fonts
> > > >
> > > >
> > > > It's quite easy if you know the pdf specification. Use
> > > > PdfReader.getPageN()
> > > > to get the page dictionary, go to the font resources and get the
> > names.
> > > > You'll have information in the font descriptor if the font is
> > embedded.
> > > >
> > > > Best Regards,
> > > > Paulo Soares
> > > >
> > > > > -----Original Message-----
> > > > > From: Archangel [SMTP:[EMAIL PROTECTED]]
> > > > > Sent: Wednesday, February 05, 2003 19:29
> > > > > To: [EMAIL PROTECTED]
> > > > > Subject: [iText-questions] Embedded fonts
> > > > >
> > > > > Hi There...
> > > > > Is it possible somehow to get a list of fonts in an existing PDF
> og
> > > more
> > > > > relevant the fonts that are used but not embedded in the file.
> > > > >
> > > > >
> > > > > David Nielsen.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > This SF.NET email is sponsored by:
> > > > > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2
> See!
> > > > > http://www.vasoftware.com
> > > > > _______________________________________________
> > > > > iText-questions mailing list
> > > > > [EMAIL PROTECTED]
> > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This SF.NET email is sponsored by:
> > > > SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> > > > http://www.vasoftware.com
> > > > _______________________________________________
> > > > iText-questions mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > >
> > > >
> > >
> > >
> >
> >
>
>
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
> http://www.vasoftware.com
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions