Hi Alex,

Alex Reichman wrote:
Dear Andreas,

I saw your thread on markmail.org and I have one question to ask you regarding PdfBox.

We are using Pdfbox.-0.7.4 for sending the PDF file to client printer when printing from Oracle Reports 11g. When I am adding alias mapping for barcode font C39P24DmTt = "V100025_.TTF" I am getting the following error:

Java code

while (setInt.hasNext()) {

                        String val = (String)setInt.next();

                        write_message("Before cast");

*PDType1Font pdt = (PDType1Font)map.get(val); //  error is here!!!!!*

       write_message("After cast");

write_message("'"+val+" "+pdt.getFontDescriptor().getFontName()+"'");

// write_message("Printing after cast " + "'"+val+" "+pdt.getFontDescriptor().getFontName()+"'");

PDFont currFont = this.loadFontByName(document,pdt.getFontDescriptor().getFontName(),val);

                        if(currFont != null)

                        {
currentPage.findResources().getFonts().put(val,currFont);
                        }

                    }

Error

DEBUG MESSAGE DirectPrint24: Map is: {f1=org.pdfbox.pdmodel.font.pdtype0f...@91d7c, f0=org.pdfbox.pdmodel.font.pdtype0f...@6ee404, f2=org.pdfbox.pdmodel.font.pdtype0f...@3bfc47}

DEBUG MESSAGE DirectPrint24: org.pdfbox.pdmodel.font.PDType0Font cannot be cast to org.pdfbox.pdmodel.font.PDType1Font


It looks like this font is not recognizable.


Any help or advice  will be much appreciated.
You're obviously expecting a type1 font but your pdf contains type0 fonts. Consequently your PDType1Font-cast has to throw an exception. I suggest to upgrade pdfbox to the 0.8-version [1]. It includes a lot of improvements and fixes, probably your alias mapping will not be needed anymore.

Thanks,
Alex * <http://www.syncreon.com/>*
Please use our mailinglist [2] for further questions. I've cc'd my answer to the users list.

BR
Andreas Lehmkühler

[1] http://pdfbox.apache.org/download.html
[2] http://pdfbox.apache.org/mailing-list.html

Reply via email to