4 Replies Latest reply: Mar 25, 2012 3:04 AM by 907990 RSS

    DirectPrint Javabean

    907990
      Hello every body

      I want to use DirectPrint Java bean and i executed the steps attached with the file to how to install it.

      I did every thing and sign all jar files but i got the following error in the java console

      DEBUG MESSAGE DirectPrint0: DIRECT_PRINT_PDF_URL: http://oradb-srv114.ports.gov.sa:7778/reports/rwservlet/getjobid4647?server=REP_oradb-srv114_FRHOME1
      DEBUG MESSAGE DirectPrint0: Printing URL: http://oradb-srv114.ports.gov.sa:7778/reports/rwservlet/getjobid4647?server=REP_oradb-srv114_FRHOME1
      DEBUG MESSAGE DirectPrint0: Pages list is NOT empty
      DEBUG MESSAGE DirectPrint0: Map is: {F1=org.pdfbox.pdmodel.font.PDType0Font@87e9bf, F0=org.pdfbox.pdmodel.font.PDType0Font@1033450}
      DEBUG MESSAGE DirectPrint0: org.pdfbox.pdmodel.font.PDType0Font cannot be cast to org.pdfbox.pdmodel.font.PDType1Font

      if some body know if there are something missing in the setup , please give me a solution

      Mahmoud
        • 1. Re: DirectPrint Javabean
          Amatu Allah Neveen Ebrahim
          Hi

          Pls have a look at This blog
          DEBUG MESSAGE DirectPrint0: org.pdfbox.pdmodel.font.PDType0Font cannot be cast to >org.pdfbox.pdmodel.font.PDType1Font
          afaik: you have also a problem in font i recommend u to upgrade ur pdf...

          Hope this helps...

          Regards,

          Amatu Allah
          • 2. Re: DirectPrint Javabean
            907990
            Dear Mr. Amatu Allah

            Thanks for your care
            I got a look at the blog and as i got understand this Java Class using to generate PrintServiceFixer.jar file to use it to override the original Win32PrintService

            but when i try to copy this code to JDeveloper as new class i got syntax error in instrument Void in this following lines

            for (CtMethod cMethod : ctClass.getDeclaredMethods())


            if (cMethod.getName().equals("getPrinterIsAcceptingJobs"))

            cMethod.setBody("return javax.print.attribute.standard.PrinterIsAcceptingJobs.ACCEPTING_JOBS;");


            - And if it working successfully
            1- where can i put this line -Xbootclasspath/p:target/PrintServiceFixer.jar ???
            2- where i have to save this file at Application Server or at Client ???
            3- How to upgrade my pdf ????

            I using oracle forms 10g

            I am waiting your response

            Thanks

            Mahmoud

            Edited by: user13099130 on Mar 20, 2012 5:57 AM
            • 3. Re: DirectPrint Javabean
              user10569070
              I am the author of the DirectPrint.jar.

              However, I wrote it at my previous place of employment. I no longer have access to my old tools and source-code. But I will try to help if I can.

              The fix for this is that you need to load the font that it is missing. There is a load_font? method that you need to call. The parameter is the full path to the TTF file. The other option is to generate the report with the fonts emdedded so the PDFBox library can use it.

              The things suggested I have never tried.

              - And if it working successfully
              1- where can i put this line -Xbootclasspath/p:target/PrintServiceFixer.jar ???

              I am not familar with this jar file

              2- where i have to save this file at Application Server or at Client ???

              All jars go on the server and are downloaded to the client and stored in the JVM cache.

              3- How to upgrade my pdf ????

              To Upgrade the PDFBox, all you need to do is drop in a new PDFBox.jar and sign it again.
              It looks like PDFBox is now part of Apache.

              http://pdfbox.apache.org/download.html



              Thanks,

              Casey
              • 4. Re: DirectPrint Javabean
                907990
                Dear Mr. Casey

                Thanks for your care

                I got read carefully your code in the java bean and understood this line

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

                Now i knew what is the problem exactly, in this method sendPDFURLToPrinter you are making a cast to this type of fonts PDType1Font and all my reports using Arial font only but Arial font it is type is PDTrueTypeFont
                so i changed all fonts of my report to Courier as a test because it is type is PDType1Font and it is working perfect but this font not support Arabic language.
                So i made some changes in the method as the following

                PDTrueTypeFont pdt = (PDTrueTypeFont)map.get(val);
                write_message("'"+val+" "+pdt.getFontDescriptor().getFontName()+"'");

                But still the error mean that there are another type of fonts is missing PDType0Font
                (DEBUG MESSAGE DirectPrint0: org.pdfbox.pdmodel.font.PDType0Font cannot be cast to org.pdfbox.pdmodel.font.PDTrueTypeFont)

                I tried to see the properties of the pdf file i found only Arial font and it is Embedded Subset and also i tried to add the TTF file by using Load_Font method and it is appeared in the console it is added successfully but still the same error while printing

                How can i get the missing font and how can i use this type PDType0Font

                So what shall i do Mr Casey

                Thanks

                Mahmoud

                Edited by: user13099130 on Mar 25, 2012 1:03 AM