Results 1 to 6 of 6
  1. #1
    alexre2005 is offline Member
    Join Date
    Dec 2009
    Posts
    3
    Rep Power
    0

    Default PdfBox and barcode fonts

    Hello,


    We are using Pdfbox to send 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()+"'");



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



    if(currFont != null)

    {

    currentPage.findResources().getFonts().put(val,cur rFont);

    }



    }



    Error

    DEBUG MESSAGE DirectPrint24: Map is: {F1=org.pdfbox.pdmodel.font.PDType0Font@91d7c, F0=org.pdfbox.pdmodel.font.PDType0Font@6ee404, F2=org.pdfbox.pdmodel.font.PDType0Font@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 will be much appreciated.


    Thanks,
    Alex

  2. #2
    dinosoep is offline Senior Member
    Join Date
    Nov 2009
    Posts
    150
    Rep Power
    5

    Default

    you say that PDType1Font pdt = (PDType1Font)map.get(val); //error is here is a pdtype1font but its a pdtype0font

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  4. #4
    alexre2005 is offline Member
    Join Date
    Dec 2009
    Posts
    3
    Rep Power
    0

    Default

    Thanks for your reply.

    Sorry for my misunderstanding:

    Do you mean line
    PDType1Font pdt = (PDType1Font)map.get(val);

    must be replaced by

    PDType1Font pdt = (PDType0Font)map.get(val);

    Thanks

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,955
    Rep Power
    19

    Default

    You haven't got two versions of PDFBox lying around have you?

    As Fubarable says, according to the API (and the src code for that matter) that cast should work.

  6. #6
    alexre2005 is offline Member
    Join Date
    Dec 2009
    Posts
    3
    Rep Power
    0

    Default

    Thank you for your reply. I have compiled my program only against PDFBox-0.7.3.jar

Similar Threads

  1. Reading text using PDFBOX
    By umadas in forum Advanced Java
    Replies: 15
    Last Post: 01-21-2012, 08:47 AM
  2. import XFDF using PDFBOX
    By jkrishnanvenkat in forum Advanced Java
    Replies: 1
    Last Post: 10-28-2009, 12:13 PM
  3. Read text content from pdf using pdfbox
    By cssatheesh in forum Advanced Java
    Replies: 0
    Last Post: 09-22-2009, 08:54 PM
  4. how do i get input from barcode reader?
    By anthrax in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 04-09-2009, 03:48 PM
  5. Fonts (Changing Fonts and Color's)
    By dbashby in forum New To Java
    Replies: 10
    Last Post: 04-06-2009, 01:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •