Ok, here is how I generated the above error on our testb server:
Here is the first portion of my stored procedure
CREATE PROCEDURE `sp_DBR_assets`(IN clientdb VARCHAR(100),
IN _location_name VARCHAR(100), IN _portfolio_name VARCHAR(100), IN _status VARCHAR(50), IN _begin_date DATE, IN _end_date DATE,
inExportFormat VARCHAR(50), inAutoReportProcedure VARCHAR(100))
BEGIN
IF (inExportFormat = 'pdf') THEN
select 'dbr.export.options', 'debug', 1;
#select 'dbr.export.options', 'content-disposition.pdf', 'attachment';
select 'dbr.title', '';
SELECT `name` into @report_name FROM mydbr_reports WHERE proc_name = inAutoReportProcedure;
select 'dbr.wkhtmltopdf', "--header-html ''"; # Disable default PDF header.
CALL sp_DBR_pdf_header(clientdb, @report_name);
END IF;
As you see I placed the debug statement in the beginning of the IF that handles a PDF export request.
p.s. I commented out for now the content-disposition because the same problem occurs whether I download it or just export it.
When I run the report from the myDBR portal the browser displays the following:
To test wkhtmltopdf pdf generation, copy the following command into the server's command line.
myDBR saved the generated HTML file into /tmp/mydbr_export_810202457.html. File size is: 97227 bytes.
$ '/usr/bin/wkhtmltopdf' --margin-top "20" --header-spacing "8" --enable-local-file-access --replace rdate "2023-07-19" --replace rtime "01:57:35 pm" --header-html '' /tmp/mydbr_export_810202457.html debug_output.pdf
So I opened up a terminal window and command line for the server, went to the webroot directory and entered
'/usr/bin/wkhtmltopdf' --margin-top "20" --header-spacing "8" --enable-local-file-access --replace rdate "2023-07-19" --replace rtime "01:57:35 pm" --header-html '' /tmp/mydbr_export_810202457.html debug_output.pdf
The response was
Loading pages (1/6)
Error: Failed to load http://tmp/mydbr_export_810202457.html, with network status code 3 and http status code 0 - Host tmp not found
Error: Failed loading page http:///tmp/mydbr_export_810202457.html (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: HostNotFoundError
I cannot send you the generated html file mydbr_export_810202457.html
because it does not exist anywhere on the machine.
And why is it trying to load http://tmp/mydbr_export_810202457.html
Does it think that the name of the server is "tmp"?
Anyway, you maybe correct that this is a lead to solving the problem because while on my local VM, when I ran the same debug test and I got the message Failed to load http://tmp/mydbr_export_464138975.html
I searched and found a file called
/tmp/systemd-private-120fd024bf864cf7a44c018a09f3bf4d-apache2.service-bX7uth/tmp/mydbr_export_464138975.html
However, on the testb server, when I ran the debug, a directory was generated named
/tmp/systemd-private-9bf2692c915b4543be3195bcb713710d-apache2.service-zWBCvi
and it generated a subdirectory called "tmp", but that tmp subdirectory was empty.
So this leaves us with questions:
1) Why on testb did it fail to generate mydbr_export_810202457.html under the above tmp subdirectory?
2) What is the connection between this failure, and the problem you state of "the server is trying to access the CSS files but fails." By the way are you referring to my userstyle.css, or to some myDBR internal css files?
3) Why when I ran the same exact report yesterday (on testb), with myDBR version 6.6.1, did the PDF export work?
Thank you for your patience, and I apologize for duplicate questions.