Announcement

Collapse
No announcement yet.

PDF export is not working

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I created a link so that any process trying to access /cmdb could do it:

    ln -s /var/www/html/prod/cmdb /cmdb
    But nothing changes so I guess it is not a path issue.
    Last edited by robydago; 01-26-2015, 10:49 AM.

    Comment


    • #17
      Your PHP ... is that mod_php or FastCGI in Apache? In my environment (FastCGI) i'am set only the rights as mentioned in post #3.
      Best regards: - Reinhard -

      I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

      Comment


      • #18
        robydago,

        try this:

        1. Try to export the pdf (so that it will create the .log file in tmp).

        2. Log into your server and cd to the directory /var/www/html/cmdb/_lib/tmp

        3. cat the .log file that you find there

        4. copy the line from the file, and paste it into your console exactly as-is and hit return. (This may give you an error)

        5. edit your command line and change "http://<path>/cmdb/_lib/tmp/<filename>.html" to "/var/www/html/cmdb/_lib/tmp/<filename>.html" and execute the new command line.

        If after doing this you actually have a usable pdf file, then the problem is a CentOS configuration problem. Let me know, and I will walk you through fixing it.

        If you still do not have a usable pdf -

        6. cat the .log file again and copy the http url, and go to a browser on your pc and try to download the .html file and see if it lets you, and tell us what happens.

        Dave
        Last edited by daveprue; 01-26-2015, 11:22 AM.
        Dave Prue
        Code Whisperer
        Lahar International Corp
        www.lahar.net

        Comment


        • #19
          Dave,

          thanks for the hint.

          4. copy the line from the file, and paste it into your console and execute it. (This will probably give you an error)
          I got this:
          Loading pages (1/6)
          Counting pages (2/6)
          Resolving links (4/6)
          Loading headers and footers (5/6)
          Printing pages (6/6)
          Done
          Exit with code 1 due to http error: 403 Forbidden

          So I changed my apache config to allow unauthenticated http access (it was authenticated and HTTPS only before) and while it gave me an error at the end
          Loading pages (1/6)
          Counting pages (2/6)
          Resolving links (4/6)
          Loading headers and footers (5/6)
          Printing pages (6/6)
          Done
          Exit with code 2 due to http error: 404 Page not found
          it actually created the PDF file with the correct content.


          5. edit your command line and change "http://<path>/cmdb/_lib/tmp/<filename>.html" to "/var/www/html/cmdb/_lib/tmp/<filename>.html" and execute the new command line.
          Using the local filepath instead of the HTTP URL, the file is created as well and without the http errors at the end.

          Since I need to enable Authentication\HTTPS again, what's the best way to solve this issue? Enabling HTTP\Unauthenticated from localhost and HTTPS\authenticated from anywhere else in the apache config (I wish I knew how... :-) ...)?

          Btw, why is SC using an http URL and not a local file path? Is there any way to tell SC to use the localpath? That would solve the issue without having to reconfigure apache, right?


          Thanks again Dave.

          Comment


          • #20
            Originally posted by RHS View Post
            Your PHP ... is that mod_php or FastCGI in Apache? In my environment (FastCGI) i'am set only the rights as mentioned in post #3.

            Reinhard,
            I think is mod_php, but anyway: 777 allows more access than 755, even if 777 is not needed and everything works with 755, using 777 cannot cause any issue.

            Thanks.

            Comment


            • #21
              Originally posted by robydago View Post
              Dave,

              why is SC using an http URL and not a local file path? Is there any way to tell SC to use the localpath? That would solve the issue without having to reconfigure apache, right?
              I brought this to the attention of NetMake about a year ago. On our web sites, we specifically force https for security reasons, and there is absolutely NO reason for them to force http instead of using the absolute file path.

              I have tried for about a year to get them to change this. I finally gave up and we do not use the scriptcase pdf applications at all, we do the tcpdf calls directly.

              If you are willing to use http, then the magic word you need is .htaccess

              BTW, if you are wondering why we would block http access, check out the rating of our web site: https://www.ssllabs.com/ssltest/anal...ecure.sahod.ph
              versus ScriptCase's: https://www.ssllabs.com/ssltest/anal...scriptcase.net

              Dave
              Last edited by daveprue; 01-26-2015, 12:38 PM.
              Dave Prue
              Code Whisperer
              Lahar International Corp
              www.lahar.net

              Comment


              • #22
                Originally posted by daveprue View Post
                BTW, if you are wondering why we would block http access, check out the rating of our web site: https://www.ssllabs.com/ssltest/anal...ecure.sahod.ph
                versus ScriptCase's: https://www.ssllabs.com/ssltest/anal...scriptcase.net

                Dave
                My keyboard has coffee all over it and my nose hurts.

                Comment


                • #23
                  PDF files get generated using HTTPS and authentication if in apache 2.4 I use this config to allow unauthenticated\HTTP from localhost

                  alias /cmdb "/var/www/html/prod/cmdb"
                  <Directory "/var/www/html/prod/cmdb">
                  <If "%{REMOTE_ADDR} -ipmatch 'x.x.x.x'">
                  Require local granted
                  </If>
                  <Else>
                  SSLRequireSSL
                  ...
                  ...
                  </Else>
                  </Directory>
                  It seems to work only if, as x.x.x.x I use the real IP of the network interface and not 127.0.0.1.
                  The only issue with this is that the config should be reviewed in cases of migrations\changes of ip addresses.

                  Btw, I know next to nothing of apache configuration, so maybe someone has a better idea on how to accomplish the same.

                  Comment


                  • #24
                    I couldn't live with an IP hardcoded in the apache config.
                    So I changed it to:


                    ...
                    <Directory "/var/www/html/prod/cmdb">
                    <If "%{HTTPS} = 'off'">
                    Require local granted
                    </If>
                    <Else>
                    SSLRequireSSL
                    ...
                    And it still works: all HTTP requests are accepted from localhost only, so SC is still happy when creating PDF files.

                    I also noticed if the client is accessing the deployed app via https://servername.domain.com/....
                    SC generates this command line on the server:

                    ./wkhtmltopdf-amd64 --page-size Letter --orientation Portrait --header-right "[page]" --javascript-delay 2000 http://servername.domain.com/cmdb/_lib/tmp/sc_g...s4aebsjq3.html /var/www/html/prod/cmdb/_lib/tmp/sc_pdf_20150124132046_127_grid_ci.pdf
                    This can make PDF not working again when the server is not able to resolve correctly the name used by the client; e.g. if the client is in the public Internet namespace and the server is in a private DMZ.

                    As SC is changing the original client request from HTTPS to HTTP, maybe it should also change any 'hostname.domain.tld' in the HTTP header to 'localhost' .
                    Last edited by robydago; 01-29-2015, 06:14 PM.

                    Comment


                    • #25
                      Any feedback on this matter? Mine also have a same problem.

                      I can't view the pdf and the downloaded pdf report also cannot be viewed. Do I need to upload the tcpdf to the server to and configure it back in my <prod>/_lib setting page?

                      Comment


                      • #26
                        Originally posted by zam2best View Post
                        Any feedback on this matter? Mine also have a same problem.

                        No, this bug has been ignored by NetMake for more than a year.

                        Dave
                        Dave Prue
                        Code Whisperer
                        Lahar International Corp
                        www.lahar.net

                        Comment


                        • #27
                          Originally posted by daveprue View Post
                          No, this bug has been ignored by NetMake for more than a year.

                          Dave
                          Means that it has been fixed or not? Really need help here as my production server has been up and running. The pdf works fine locally (including local separate development server for testing) but the production server is not working. Do I need to configure something in the production environment??

                          Comment


                          • #28
                            Originally posted by zam2best View Post
                            Means that it has been fixed or not? Really need help here as my production server has been up and running. The pdf works fine locally (including local separate development server for testing) but the production server is not working. Do I need to configure something in the production environment??
                            The bug still exists as far as I know.

                            After several months of waiting and hoping, I changed our site to use TCPDF calls directly, rather than using ScriptCase's pdf functionality.

                            Dave
                            Dave Prue
                            Code Whisperer
                            Lahar International Corp
                            www.lahar.net

                            Comment


                            • #29
                              Originally posted by daveprue View Post
                              No, this bug has been ignored by NetMake for more than a year.

                              Dave
                              BUG is whether you can replicate the problem in all situations, or under some specific situations.

                              AFAIK, PDF export problems are related to permissions.
                              /Giuseppe

                              Professional Scriptcase Services
                              Some Customers opinions

                              Comment


                              • #30
                                Giu,

                                BUG is whether you can replicate the problem in all situations, or under some specific situations.
                                I appreciate you trying to clarify for me, however my 35 years of managing software development projects has given me a fairly good idea of what a bug is.

                                If you read the thread, scriptcase is inserting an http:// reference into the wkhtmltopdf input file. This is absolutely wrong. It should be an absolute path. It is a BUG. It does not cause problems for everyone, because some people do not care to use https, but it is repeatable and it is a bug.

                                AFAIK, PDF export problems are related to permissions.
                                Many times they are, but that is not what we are talking about.

                                I reported this bug well over a year ago, and like all the bugs I have reported, have heard nothing back.

                                Dave
                                Last edited by daveprue; 02-26-2015, 05:57 AM.
                                Dave Prue
                                Code Whisperer
                                Lahar International Corp
                                www.lahar.net

                                Comment

                                Working...
                                X