9 Replies Latest reply on Jul 15, 2014 1:44 PM by Mike Kutz

    PDF Report Printing

    m.davide

      Oracle Apex Version: 4.2.2.0.11

      Oracle Database: 11g R2

      App Template: Blue Responsive - 25 *

      Browser: Chrome

      My PC's OS(dunno if it matters): Ubuntu 14.04LTS (I just switched to Ubuntu from W7)

       

      What I did so far:

      1. Set the print server to: Oracle APEX Listener

      2. Enabled Printing on my report

      3. Everything else is default. (output is PDF, default report layout, etc.)

       

      What happens:

      1. When I click the 'print' link my browser downloads the pdf file. When I click it and open it w/ my browser I get a 'failed to load pdf file' message.

      2. Opening it on my pdf viewer also doesn't show my report. It returns an error: 'File type HTML document(text/html) is not supported'

       

      EDIT:

      What I've researched:

      1.Here is a similar problem that has a solution (I didn't want to hijack his thread): Oracle Apex 4.2.4 cannot create PDF

      2. I also opened my pdf file w/ a text editor, it also contained an xml-stylesheet

      3. The solution was not explained properly, I'm not too familiar with admin stuff in oracle, I'm just a developer.

        • 1. Re: PDF Report Printing
          backintheday

          m.davide,

           

          Quick quesiton: are you using a report template?  If so, only XSL-FO 1.0 is supported.  I have seen the error you noted before when trying to apply an XSL-FO template formatted as version 2.0.

           

          -Seth.

          • 2. Re: PDF Report Printing
            m.davide

            Report template is default. Region is classic report.

            • 3. Re: PDF Report Printing
              backintheday

              Where is the APEX Listener deployed (WebLogic, GlassFish, standalone)?  Have you tried redeploying the listener?

              • 4. Re: PDF Report Printing
                seanzh

                There is  another approach: https://sourceforge.net/projects/pljrxml2pdf/


                I got this link from this forum too. i would say it's the best PDF solution for Apex( pure PL/sql, no middle tier like  BI/Apache module), Mr. Weiden did an incredible job integrating such a package into Apex.  I started to use his plugin one week ago, it's powerful, easy and you get good support too( there is  a  discussion for this plugin).


                This plugIn  uses  Jrxml (  JasperSoft report designer called iReport, I use the new version: Jaspersoft Studio 5.6.0) as meta report data, Mr.Weiden made a PL/SQL package to render Jrxml (report definition) into PDF, you can then print or display it  in Apex page.  I have to learn JasperSoft studio ( not hard) to get a relatively sophisticated Order report ( the typical  Invoice you see almost everywhere:  Header Info, Line items list then summary, plus company logo, has to be reasonably pretty because customers will laugh my skills otherwise).  PL2PDF only supports a subset of  JSStudio functions but it's good enough , especially if you combine SQL/PL-sql into the reports,  the best yet: you may NOT need learn and know much about JRXML at all if  your reports is  something like classic report (tabular data only, not forms data), just use  another package Mr. Weiden made to  generate JRXML for  you-----it does  a good job generating Jrxml from reports ( not forms though).  Really simple.  you can get  a  simple PDF reporting in  about   1 hour from scratch....   it's highly recommended by me ( I have years of  experience with oracle Reports and some experience with BI, I don't know XSL-FO  but PL2PDF is by far the best  for  Apex).


                Hope this helps.





                • 5. Re: PDF Report Printing
                  Mike Kutz

                  m.davide wrote:

                   

                  2. I also opened my pdf file w/ a text editor, it also contained an xml-stylesheet

                   

                   

                  This should be HTML code that contains some error information.

                  Also, check the log files for the Listener.

                   

                  Did you enable printing within the Listener?  (this requires a manual modification of a config file)

                  Did you add the appropriate ACL to the database to allow APEX_{version} to communicate with the Listener Server?

                  • 6. Re: PDF Report Printing
                    m.davide

                    Mike Kutz wrote:

                     

                    m.davide wrote:

                     

                    2. I also opened my pdf file w/ a text editor, it also contained an xml-stylesheet

                     

                     

                    This should be HTML code that contains some error information.

                    Also, check the log files for the Listener.

                     

                    Did you enable printing within the Listener?  (this requires a manual modification of a config file)

                    Did you add the appropriate ACL to the database to allow APEX_{version} to communicate with the Listener Server?

                     

                    How do I edit the config file? Where is it located? How do I add the appropriate ACL?

                     

                    EDIT:

                    Based on the replies I got on this thread I found this link: Downloading from Oracle Technology Network

                    I will ask our dba to enable Network Services.. I hope it fixes the problem.

                     

                    A quote from the link above:

                    By default, the ability to interact with network services is disabled in Oracle Database 11g release 1 or 2. Therefore, if you are running Oracle Application Express with Oracle Database 11g release 1 or 2, you must use the new DBMS_NETWORK_ACL_ADMIN package to grant connect privileges to any host for the APEX_040000 database user. Failing to grant these privileges results in issues with:

                    • Sending outbound mail in Oracle Application Express.Users can call methods from the APEX_MAIL package, but issues arise when sending outbound email.
                    • Using Web services in Oracle Application Express.
                    • PDF/report printing.
                    • Searching for content in online Help (that is, using the Find link).

                     

                    Message was edited by: m.davide

                    • 7. Re: PDF Report Printing
                      Mike Kutz

                      Page 9 contains location and parameter to change.

                      http://www.oracle.com/technetwork/developer-tools/apex/learnmore/custom-pdf-reports-1953918.pdf

                      (rereading this document seems to indicate that you only need to do the modification if you're using the APEX_UTIL.get/download_print_report() procedures.)

                       

                      For the ACL, your DBA should be able to handle that for you with ease.

                       

                      Also, you're missing the following information.

                      What version of the Listener ORDS are you using?

                      Which app server?  version?

                      which Java version?

                       

                      I don't think printing works when running ORDS in "standalone mode".

                       

                      MK

                      • 8. Re: PDF Report Printing
                        m.davide

                        This is the only version that I can see: Application Express 4.2.2.00.11

                         

                        I think our Apex is stand alone, I've never heard them mention app servers.

                        • 9. Re: PDF Report Printing
                          Mike Kutz

                          APEX is a bunch of PL/SQL packages that runs inside the database.

                          By itself, it can not act as a "web server".

                           

                          There are three methods you can use that does the "translation" between HTML (technically HTTP) and PL/SQL

                          • APEX Listener ORDS
                          • HTTP server (Apache) + mod_plsql
                          • Embedded PL/SQL Gateway [EPG]

                           

                          One of the questions that is normally asked is "How are you connecting to APEX? (ORDS,EPG,etc.)"

                          I've assumed that the answer was ORDS.  Now, I'm not 100% sure.

                           

                          Please verify how you are connecting to APEX.  Your DBA should be able to help out on this.

                          If you are using ORDS, you can be running in standalone mode or you are using an app server (Glassfish, Tomcat, WebLogic).

                           

                          MK