Export to PDF Does not Work

How many of you are experiencing this issue? Running SC 9.4 or 9.5 on a LAMP stack with Centos 7.8, the wkhtmltopdf executable produces the html, css and log files in the tmp folder but not the PDF itself. Generates a 404 error. The site is HTTPS.

Is there a solution?

what do you find in the log? can you attach it?

Which log? Do you mean the log file created during the export?sc_pdf_20201027181532_552_grid_projects.log (324 Bytes)

Me too.
I solved it by intervening in the application configuration https://www.yoursite.xxx/_lib
Temporary files directory: /home/xxx/web/xxx.yyy/public_html/_lib/tmp
PDF Server IP: /home/xxx/web/xxx.yyy/public_html/

And so it worked!

Ciao
Enrico

Thank you, Enrico. I tried that and got the following in the log file:
html path: /home/XXXXX/public_html/accounts/system//system/_lib/tmp/sc_appname_randomcharacters.html
The PDF path was correct but no PDF was in the tmp folder. The html file was, but as you can see, an additional “/system” was added to the path. I changed the path in the configuration to omit the “/system” and tried again and the path was the same - still adding the extra “/system” to the path. I’m really baffled now! I also tried going back to having the “PDF IP” field blank - which produced the absolute URL for the html in the log file and STILL the log file showed the wrong path as above.
So, I’m back to square one…

At this point I don’t know what to tell you.
Very strange that it adds a / system … very strange!
NetMake’s help would have to be invoked, but I’m afraid they won’t get back to you.
NETMAKE SUPPORT EQUAL TO ZERO.
I am 15 days waiting to know the meaning (and solve it) of their error in generation, but nothing.
When they get a complaint with a request for damages they wake up!

Agreed on all your points!

Hello, give 774 permission to wkhtmltopdf file.
Config the pdf route where you config the database.
Your hosting must admit the execution of wkhtmltopdf file. Some hostings denied for security issues.

Hi,
I’m not a programmer so I do it because experience only.
Every time I deploy a project on production server I run this sequence of commands:

find /home/eosbbaho/public_html/eos_inventory/ -type d -exec chmod 755 {} ;
find /home/eosbbaho/public_html/eos_inventory/ -type f -exec chmod 644 {} ;
find /home/eosbbaho/public_html/eos_inventory/_lib/prod/third/wkhtmltopdf/ -type d -exec chmod 755 {} ;
find /home/eosbbaho/public_html/eos_inventory/_lib/prod/third/wkhtmltopdf/ -type f -exec chmod 755 {} ;

eos_inventory it’s the project folder

Let’s try if it can help you or not
Bye
Giovanni

The problem is that wkhtmltopdf is not designed to handle an HTTPS HTML file. If you go to the command line and look at the log file and run the commands there you will find that it cannot handle the secure socket layer to the HTML file. This is something that I have told Scriptcase multiple times for multiple versions of the program for multiple years. They totally ignore it and always let support time run out on the issue and close it. If your server is forcing a secure connection wkhtmltopdf will not work the way that Scripcase has coded it. They can fix this with ease if they just decided to do it.

You will find where the HTML created at https://yourdomain/yourprogram/tmp/grid.html cannot be loaded by wkhtmltopdf and will tell you it cannot handle the encrypted file. This is code passed by the programming in Scriptcase. Instead of having the file be passed as https://yourdomain/yourprogram/tmp/grid.html they could allow a path like /var/www/public/html/yourprogram/tmp/grid.html and it would work. In fact in the config file you can set this up but the programmers decided to ignore that configuration, which is their own.

If you think the really ticks me off, you would be correct.

I had this problem before, I finally changed the permission of wkhtmltopdf folder to 777 and works.

Thank you. I do set permissions of the file and folder to either 755 or 777. In the past sometimes it will work with 755, sometimes it takes 777. But now it does not work with either. It produces all files EXCEPT the PDF.

Way ahead of you on this one. Still doesn’t work. But thank you for the advice.

A few years ago, when I first encountered this issue (after setting most of the sites up with HTTPS) I figured this out as well. I don’t know how I got it to work but it eventually did work with https. I have had a dozen or so projects installed for several years on HTTPS and it has worked. It stopped when I moved them all to a new VPS container. I feel there is something else going on here besides this issue, although I know it is a recurring problem and might be related. I have one project deployed to a University server which was set up by their IT and is very secure - lots of extra settings employed to protect their data. Of course, they are using HTTPS and the PDF export WORKS there. The only difference is if you choose the “Open” option, it does not open in the browser but instead prompts you to download to your local machine. BUT IT WORKS. So while I do appreciate your comments and feel your pain, I have had this function work on HTTPS sites up until now.

In fact, I think I will contact their IT guy and ask him how he made it work, despite all their security settings and why it only prompts to download. That might be a clue as to why it’s not working for my sites on my own VPS container. If I find out anything, I’ll post it in this thread.

I have had it work in the past also, years ago. It was before I started forcing an https connection. I did make a change though to allow for unsecure connection on my server and that unfortunately did not solve the problem. Now the only thing that gets it done is if I SSH into the server and run the command line changing the https to an actual path to the file. Then it works.

The folder permission must be 755. The file wkhtmltopdf .exe 744. You may have more than one wkhtmltopdf.exe file depending the OS. Verify this inside the wkhtmltopdf folder.
Some hostings blocks all files if you put 777 permissions.
Configure your production invironment PDF Server IP

As I told you some hostings blocked the execution of this files. You must ask them.

Bye.

The server admin at the site which WILL export even with https said:

The internal URLs that called the wkhtmltopdf executable didn’t work through HTTPS. So I configured Apache to allow HTTP requests that originate from the same system.

The other issue I found was a mismatch between the version of OpenSSL utilized by wkhtmltotpdf and the version that was installed on the server.

If wkhtmltopdf writes files within the html root, then that folder would need to be owned by the Apache process, and the “httpd_unified” SELinux boolean would need to be enabled. I just checked, and the /system/_lib/prod/third/wkhtmltopdf/linux-amd64 folder is owned by apache, and the “httpd_unified” SELinux boolean is enabled.

I checked ownership of the wkhtmtopdf folder and contents, and it’s the account user, not the Apache process. Does that jive with your experience?

Thank you again. I’ll try changing the permissions as you suggest. Yes, some hosts will not like permissions set at 777 for a file. AFAIK, this is not an issue with my host. But I can check that out, too.

When you say “Configure your production environments PDF Server IP” - what do you put in yours? The root URL to the website or to the deployment of your project? Or the path in the server files? Or something else? When I first saw that field I put the actual IP address - you’d think that’s what should be put there - but that doesn’t work, does it!

My experience is a bit different. I run my own servers and my customers log onto them. I also do not use Apache for security reasons, I use Nginx. All of my folders are owned and grouped within www-data which is the web servers account. I chmod wkhtmltopdf and /tmp as 777. I have configured the server to allow a non-secure connection but that did not get the job done. The only thing that works is a path from the root of the server to the actual html file that is generated.

If Scriptcase would just make a minor adjustment in the command file that they run to pass the grid to wkhtmltopdf the problem would be totally solved and would work on any server. For some reason fixing past bugs is not something that they seem to do. I have been in communication with them many times and they just let things time out on the support site.

Thanks a lot. I agree with you - support is lousy if you can even get it. I paid once and vowed never again. I won’t bug you anymore. I appreciate your input.