PDFBox
  1. PDFBox
  2. PDFBOX-1271

Bug during direct printing PDF using pdfbox-1.6.0.jar

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Not a Problem
    • Affects Version/s: 1.6.0
    • Fix Version/s: None
    • Component/s: Swing GUI
    • Labels:
      None
    • Environment:
      Windows XP SP3 32 bit

      Description

      I got the following exception during direct print using pdfbox-1.6.0.jar,fontbox-1.6.0.jar,jempbox-1.6.0.jar and commons-logging-1.1.1.jar

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

      i am using Oracle Report Server 10g and i am trieng to print PDF file including Arial font only it is fully embedded and it is type is TrueType not PDType0Font

      Please tell how can i solve this problem

      Thanks

      Mahmoud

      1. Screen Shot2.JPG
        98 kB
        Maho Rashad
      2. Screen Shot.JPG
        116 kB
        Maho Rashad
      3. Java Code2.txt
        28 kB
        Maho Rashad
      4. Java Code.txt
        28 kB
        Maho Rashad
      5. FFF.pdf
        115 kB
        Maho Rashad

        Activity

        Hide
        Andreas Lehmkühler added a comment -

        P.S.: getFontName() delivers null as the pdf doesn't provide any.

        Show
        Andreas Lehmkühler added a comment - P.S.: getFontName() delivers null as the pdf doesn't provide any.
        Hide
        Andreas Lehmkühler added a comment -

        I agree with Timo. This is not a PDFBox issue.

        Return to the mailing list if you have any further questions.

        Show
        Andreas Lehmkühler added a comment - I agree with Timo. This is not a PDFBox issue. Return to the mailing list if you have any further questions.
        Hide
        Timo Boehme added a comment -

        This still is not a PDFBOX problem but a problem in your code. From your example I assume that getFontDescriptor returned null and thats why you get a NullPointerException which you catch in your general Exception catch clause (not a good idea for debugging - at least a stack trace should be printed).

        Thus first test your PDF with the PDFBOX tools if there is a problem (show/create image etc.). If you find a problem than we are able to reproduce and fix it. Otherwise please invest more work in debugging your code first.

        Show
        Timo Boehme added a comment - This still is not a PDFBOX problem but a problem in your code. From your example I assume that getFontDescriptor returned null and thats why you get a NullPointerException which you catch in your general Exception catch clause (not a good idea for debugging - at least a stack trace should be printed). Thus first test your PDF with the PDFBOX tools if there is a problem (show/create image etc.). If you find a problem than we are able to reproduce and fix it. Otherwise please invest more work in debugging your code first.
        Hide
        Maho Rashad added a comment -

        Sorry but let me ask you two questions

        1- Are you still working on fix this problem ??
        2- is this problem was fixed in other version ??

        Thanks

        Mahmoud

        Show
        Maho Rashad added a comment - Sorry but let me ask you two questions 1- Are you still working on fix this problem ?? 2- is this problem was fixed in other version ?? Thanks Mahmoud
        Hide
        Maho Rashad added a comment -

        hellooooooooooo

        Show
        Maho Rashad added a comment - hellooooooooooo
        Hide
        Maho Rashad added a comment -

        I know well there are a problem in casting but when i try to change it as the following

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

        and insert this line after to print the font name

        write_message("My Font is = " + pdt.getFontDescriptor().getFontName());

        it is print

        DEBUG MESSAGE DirectPrint0: null

        it is mean there are something happend in casting also without print any thing , please see the attached Screen shot 2

        Show
        Maho Rashad added a comment - I know well there are a problem in casting but when i try to change it as the following PDType0Font pdt = (PDType0Font)map.get(val); and insert this line after to print the font name write_message("My Font is = " + pdt.getFontDescriptor().getFontName()); it is print DEBUG MESSAGE DirectPrint0: null it is mean there are something happend in casting also without print any thing , please see the attached Screen shot 2
        Hide
        Andreas Lehmkühler added a comment -

        The culprit is your own code. You can find the wrong cast in sendPDFURLToPrinter() line 508. The pdf in question contains 2 Type0 fonts which can't be cast to a Type1 font.

        Show
        Andreas Lehmkühler added a comment - The culprit is your own code. You can find the wrong cast in sendPDFURLToPrinter() line 508. The pdf in question contains 2 Type0 fonts which can't be cast to a Type1 font.
        Hide
        Maho Rashad added a comment -

        This sceenshot from Java console

        Show
        Maho Rashad added a comment - This sceenshot from Java console
        Hide
        Maho Rashad added a comment -

        This the PDF file and the Java Code

        Show
        Maho Rashad added a comment - This the PDF file and the Java Code

          People

          • Assignee:
            Andreas Lehmkühler
            Reporter:
            Maho Rashad
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development