Question: Pdf File Is Not Displayed Properly On Localhost

Pdf File Is Not Displayed Properly On Localhost

The generated PDF file looks as if it lacks styles, and images are not loaded, even though the logo has been loaded into the application. The invoice status picture is also not visible. The

Ł

Łukasz

Asked
The generated PDF file looks as if it lacks styles, and images are not loaded, even though the logo has been loaded into the application. The invoice status picture is also not visible.

The application runs on localhost, and works fine by itself.

The Apache server alias is set to:
Alias /simple_invoice_manager "d:/www/simple_invoice_manager/www/"
where the first "www" is root for PHP.

Additionally, there are entries in the htaccess file:
RewriteBase /simple_invoice_manager/
and for hosting:
RewriteRule ^(.*)$ index.php?/$1 [L]
and for SSL:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Let me add that the rule for SSL doesn't break anything.
My PHP version is: 7.3.12

Please help me fix the problem.

Łukasz
  • SS

    Scott Smith

    Answered
    I am not certain, but perhaps a review of https://www.php.net/manual/en/migration56.openssl.php will help?
  • MS

    Mian Saleem

    Answered
    Hello,

    It's setup related and there is already thread for alternates :(

    You can try ngrok

    Thanks
  • Ł

    Łukasz

    Answered
    **[Scott Smith](/u/grimblefritz)** Thank you Scott, the link was helpful in some way. As I wrote earlier, I wrote a solution based on cURL to fix the get_image() method and the solution works fine.

    By using stream_context_create with the crypto_method set, I get a positive effect (with the cafile and capath set), but the invoices generate strangely slowly, because I wait almost one minute (!sic) for the invoice. Maybe it is a matter of additional settings, which are either in the application or in the server configuration. Maybe.

    I definitely prefer the solution based on cURL, where nothing blocks the generation of an invoice that is generated in about a second. And I will develop this function further. I do not have time to search for additional or external solutions.

    My guess is that if it wasn't for localhost / virualhost it wouldn't be the problem, but it is what it is. And I admit, I think (maybe it's just my opinion) that the application should fully support localhost by default.

    Thanks
    Łukasz
  • Ł

    Łukasz

    Answered
    **[Mian Saleem](/u/saleem)** Thanks for your time, but I don't want external solutions. I expected the application to run smoothly on a local and/or public server. As in the case of, for example, Wordpress.

    The solution I wrote based on cURL works fine, nothing blocks the generation of an invoice that is generated quickly and without errors. I will continue to develop this feature.

    For me, localhost support (also with SSL/TLS) is a basic thing. After all, the application is not built on the target/public server.
    And here we can probably end this thread. It cost us a lot of time and nerves, and that's not good. I have a few days to deliver the final product, so I have been running out of time from day one.

    I wish you all the best
    Łukasz
  • Login to Reply