Hello everyone:

I am currently using pdfbox to convert pdf to tiff.

My existing pdf uses different fonts, not those STANDARD_14 defined in
PDType1Font. As result, fonts are replaced by default fonts when PDF is
converted to Image (page.convertToImage).

Although the display (see below code segment)  are correct fonts type, they
are changed to some type else after pdf is converted into TIFF. The real
types of Arial, TimesNewRoman are not used. Can you please let me know how
to make system fonts, Arial, TimesNewRoman etc, re-load before convert PDF
to image? Thank you very much.

Display result:

T1_1 - CourierStd
T1_0 - MyriadPro-Regular
TT4 - Verdana
TT3 - TimesNewRoman,Bold
TT2 - Arial,Italic
TT1 - Arial,Bold
TT0 - Arial


Code segment:

   PDDocument document = PDDocument.load(pdf_filename);
   List pages = document.getDocumentCatalog().getAllPages();
   for( int i=0; i<pages.size(); i++ ){
       PDPage page = (PDPage)pages.get( i );

       PDResources resource = page.getResources();
       Map fonts = resource.getFonts();

       Iterator keyIterator = fonts.keySet().iterator();
       Object key = null;
       PDSimpleFont font = null;
       //PDFontDescriptor desc = null;
       System.out.println("Fonts list in page - " + i);
       while(keyIterator.hasNext()){
           key = keyIterator.next();
           font = (PDSimpleFont)fonts.get(key);
           System.out.println(key.toString() + " - " +
font.getFontDescriptor().getFontName());
       }
}


Henry

Reply via email to