Concerning the first step, I have tried the following code :

public void execute() {
            try {

                  // we retrieve the total number of pages
                  int n = reader.getNumberOfPages();

                  for (int i = 0; i < n; i++) {
                        System.out.println("Page:" + i);
                        PdfDictionary page = reader.getPageN(i + 1);
                        Object oResources = page.get(PdfName.RESOURCES);
                        if (oResources instanceof PdfDictionary) {

                              PdfDictionary resources = (PdfDictionary)
oResources;
                              PdfDictionary fonts =
                                    (PdfDictionary)
resources.get(PdfName.FONT);
                              Set keys = fonts.getKeys();
                              Iterator iterKeys = keys.iterator();
                              while (iterKeys.hasNext()) {
                                    Object key = iterKeys.next();
                                    System.out.println(key);
                                    PRIndirectReference ir
= (PRIndirectReference)fonts.get((PdfName)key);
                                    System.out.println(ir.type());
                                    System.out.println(ir.getNumber());
                                    byte[] b = ir.getBytes();
                                    if (b !=null) {

                                    String content = new String(b);
                                    System.out.println(content);
                                    }
                              }
                        }
                  }

            } catch (Exception de) {
                  de.printStackTrace();
            }
      }

but I can't go further. At least, is it the right way ?

Regards,

Fabrice DUERMAEL


|---------+---------------------------------------->
|         |          [EMAIL PROTECTED]           |
|         | Internet                               |
|         |                                        |
|         |          30/05/03 11:49                |
|         |                                        |
|---------+---------------------------------------->
  
>------------------------------------------------------------------------------------------------------------------|
  |                                                                                    
                              |
  |     Pour:       Fabrice DUERMAEL, itext-questions                                  
                              |
  |     cc:                                                                            
                              |
  |     ccc:                                                                           
                              |
  |     Objet:      RE: [iText-questions] embed fonts in a Pdf File                    
                              |
  
>------------------------------------------------------------------------------------------------------------------|




It's possible to do it but you'll have to write some code and know very
well
the structure of iText and PDF. The steps are:

- find all the font names and locations in the pdf
- match those names with the actual fonts, TT or T1
- create a new stream with the font and insert the appropriated key in the
font descriptor

Note that the fonts cannot be subset.

Best Regards,
Paulo Soares

> -----Original Message-----
> From:            [EMAIL PROTECTED]
> [SMTP:[EMAIL PROTECTED]
> Sent:            Friday, May 30, 2003 9:04
> To:        [EMAIL PROTECTED]
> Subject:         [iText-questions] embed fonts in a Pdf File
>
> Hello,
>
> In order to reduce the storage room in our database, we do not include
> some
> specific fonts in our PDFs. These fonts does not exist neither on the
> client.
> So, we would like to embed them on the application server.
>
> 1.Read a PDF
> 2.Embed fonts
> 3.Send it to client
>
> Is it possible ? If so, how ?
>
> Best Regards,
>
> Fabrice DUERMAEL
> BNP Paribas
>
>
>
>
> **********************************************************************
> L'integrite de ce message n'etant pas assuree sur Internet,
> BNP Paribas Assurance ne peut etre tenu responsable de son contenu.
> Si vous n'etes pas destinataire de ce message confidentiel,
> Merci de le detruire et d'avertir immediatement l'expediteur.
>
> The integrity of this message cannot be guaranteed on the
> Internet. BNP Paribas Assurance can not therefore be considered
> responsible
> for the contents.
> If you are not the intended recipient of this confidential message,
> then please delete it and notify immediately the sender.
>
> **********************************************************************
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: eBay
> Get office equipment for less on eBay!
> http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions







**********************************************************************
L'integrite de ce message n'etant pas assuree sur Internet,
BNP Paribas Assurance ne peut etre tenu responsable de son contenu.
Si vous n'etes pas destinataire de ce message confidentiel,
Merci de le detruire et d'avertir immediatement l'expediteur.

The integrity of this message cannot be guaranteed on the
Internet. BNP Paribas Assurance can not therefore be considered responsible 
for the contents. 
If you are not the intended recipient of this confidential message,
then please delete it and notify immediately the sender.

**********************************************************************



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to