Error creating PDF file, contact technical support.

Hi All

I have created a grid application and whenever i have to export this to a pdf an error comes up Error creating PDF file, contact technical support. in my hosted server.
But when i try it in my local server it works fine.

I have changed the folder permission to 777. but still found the error.

Can anyone help me to sought this out.?

Thanks!

Check your php.ini likely it is having the following:
disable_functions =exec

disable_functions=no value

Same error on a very simple application that was working until few weeks ago.
I cannot imagine what can be the cause of this error.
Where is generated such a generic message error?
Who is and where is the technical support?
Mimmo

Attention RR Moderator.
When you write
"Check your php.ini likely it is having the following:
disable_functions =exec "
do you mean that the parameter disable_functions MUST HAVE or NOT the value EXEC?
Thanks
Mimmo

It should NOT have exec in there
 exec is a php function which must be allowed in roder to run wkhtmltopdf.
And not all providers will allow exec to be performed


Yes that is the issue the hosting service provider not to provide exec for security issue. if you go with the VPS or any other server then it is works properly.

PDF export ERROR.
I’ve checked my php.ini and the line disable_functions doesn’t contain any parameter.
Running phpinfo.php this status is confirmed.
Until few weeks ago it worked properly.
The server is a VPS on Linode and it’s full managed by myself without restrictions.

What else can I try? what is the internal function that should be executed?
Thanks

Is there a pdf being created? It should be created in the tmp dir and it is then normally called something like sc_
pdf you can check the creation date.

Hi, rr!
No PDF is created and this is the reason for which I’m writing.
Lets’s summarize:

  1. I’m able to export a grid as XLS or RTF or DOC
  2. When choosing PDF I get the error Error creating PDF file, contact technical support.
  3. The parameter disable_functions in php.ini is empty (so there are no functions disabled)
  4. In the tmp folder there is no PDF file created and all users have Read-Write-Execute permissions
    It’s boring to be stopped by this kind of errors described in a too generic way.

I hope someone can help because my purchase of ScriptCase reveals useless.

Thanks to all

Attn, rr
I have furtherly investigated about why I’m not able to export PDF files and I’ve found what follows.
a) When clicking Export to PDF in the folder /opt/NetMake/v81/wwwroot/scriptcase/tmp the following files are created:

  1. sc_css_grid_FSTL-2_grid_106.css
  2. sc_grid_FSTL-2_html_vp1p9l1m2tm7r2got6qtg5lia1.html
  3. sc_pdf_20170129164820_9_grid_FSTL-2.log

The logt file probably explains why the file is not created
./wkhtmltopdf-amd64 --page-size Letter --orientation Landscape --outline-depth 0 --footer-right “[page]” http://MyPrivateIpAddress:8081/scriptcase/tmp/sc_grid_FSTL-2_html_vp1p9l1m2tm7r2got6qtg5lia1.html /opt/NetMake/v81/wwwroot/scriptcase/tmp/sc_pdf_20170129164820_9_grid_FSTL-2.pdf

Executing manually wkhtmltopdf exactly how it’s written in the log file I get this error:
/opt/NetMake/v81/wwwroot/scriptcase/prod/third/wkhtmltopdf/linux-amd64/wkhtmltopdf-amd64: error while loading shared libraries: libXrender.so.1: cannot open sha red object file: No such file or directory

wkhtmltopdf doesn’t depend on libXrender, but to test if this was the cause I’ve installed this library without success, but nopw I get a new error:
/opt/NetMake/v81/wwwroot/scriptcase/prod/third/wkhtmltopdf/linux-amd64/wkhtmltopdf-amd64: error while loading shared libraries: libfontconfig.so.1: cannot open shared object file: No such file or directory

It’s clear that wkhtmltopdf has not been installed completely and properly.
I could do it, but I cannot move it into the folder required by Scriptcase.

Can you please, clarify.
This is not my misunderstanding, but it’s a bug in the installation script of ScriptCase.

Thanks
Mimmo

Hi TravelPlus,

I have the same problem.
Is funny when I create a pdf application, so it works.
Export to Word or Excel works well from grid.

Do you already have a solution?

The only solution I can imagine is to install wkhtmltopdf from a Debian-Ubuntu repository, but I don’t know (really I don’t have time to experiment) how to install the package into the folder /opt/NetMake/v81/wwwroot/scriptcase/prod/third/wkhtmltopdf/ .
Apt-get install decides by itself where to place the files.
It would be better to let apt-get to decide where to install and after create a symbolic link to the latest version of wkhtmltopdf.
This will be also useful in case of updating the package.

It would also be nice to hear from ScriptCase experts why this happens.
Maybe my theories are wrong, but I already spent a couple of hours to make a diagnose 

Ciao
Mimmo

Great interest on behalf of ScriptCase staff!
The same as when selling :frowning:

I must admit that I did not like the automatic pdf reports, so I created a pdfreport app for each report I required and added a button with a link on the grids. That gave me a better result and the ability to create reports with consistency of output.

They are not always easy, but I managed with some help.

I always design my report as HTML table and put my fields, every field on its correct place. then i copy the code to SC (HTML Template), then i make the grid as (user defined) and at final i go to (field positioning) and set my fields. This approach is so easy and give you very nice reports, also you will get your report in no time, after that you can convert it to Pdf if needed.

Sounds like that is worthy of a YouTube video?

Hmm interesting

Basically when scriptcase makes a pdf from a grid it calls the url on which it runs. So if your grid is called mygrid then it executes wkhtmltopdf.exe with options followed by the url and the filename to store it in.
For example (this is not exact!) something like:
wkhtmltopdf.exe -s A4 http://mywebsite/myproject/myapp myapp.pdf

If you really want to know it exactly you will need to look in the generated source code just search for the string wkhtmltopdf.exe (assuming windows) and you’ll find it.
You can hack the generated code a bit by echoing the commandline to a cmdline.txt yto get the info.

Look at this code (yours will be very similar):

[SIZE=3][COLOR=#007700][COLOR=#000000]2046| if (FALSE !== strpos(strtolower(php_uname()), ‘windows’))
2047| {
2048| chdir($this->Ini->path_third . “/wkhtmltopdf/win”);
2049| $str_execcmd2 = ‘wkhtmltopdf ’ . $str_pd4ml . $Win_autentication . ’ --header-right “[page]”’;
2050| }
2051| elseif (FALSE !== strpos(strtolower(php_uname()), ‘linux’))
2052| {
2053| if (FALSE !== strpos(strtolower(php_uname()), ‘i686’))
2054| {
2055| chdir($this->Ini->path_third . “/wkhtmltopdf/linux-i386”);
2056| $str_execcmd2 = ‘./wkhtmltopdf-i386 ’ . $str_pd4ml . $Win_autentication . ’ --header-right “[page]”’;
2057| }
2058| else
2059| {
2060| chdir($this->Ini->path_third . “/wkhtmltopdf/linux-amd64”);
2061| $str_execcmd2 = ‘./wkhtmltopdf-amd64 ’ . $str_pd4ml . $Win_autentication . ’ --header-right “[page]”’;
2062| }
2063| $arq_pdf_in = str_replace(“https://”, “http://”, $arq_pdf_in);
2064| }
2065| elseif (FALSE !== strpos(strtolower(php_uname()), ‘darwin’))
2066| {
2067| chdir($this->Ini->path_third . “/wkhtmltopdf/osx/Contents/MacOS”);
2068| $str_execcmd2 = ‘./wkhtmltopdf ’ . $str_pd4ml . $Win_autentication . ’ --header-right “[page]”’;
2069| }
2070|
2071| if (!isset($_SESSION[‘scriptcase’][‘phantomjs_charts’]) || !$_SESSION[‘scriptcase’][‘phantomjs_charts’])
2072| {
2073| $str_execcmd2 .= ’ --javascript-delay ’ . 2000;
2074| }
2075|
2076| $str_execcmd2 .= ’ ’ . $arq_pdf_in . ’ ’ . $arq_pdf_out;
2077|
2078| $arr_execcmd = array();
2079| $str_execcmd = $str_execcmd2;
2080| exec($str_execcmd2);
2081| // ----- PDF log [/COLOR][/COLOR][/SIZE]

You can see the exe command being executed. SO if you want to know why something goes wrong then edit the generated code to show you the commandline

$str_execcmd2 thus needs to be logged somewhere so you can see what happens

That is the command being executed.
There are reasons why this can fail. So if you can get on your deployment server you need to check that wkhtmltopdf even works on your server. If not ask your admin if he can allow it.
If not then you’re in bad luck since this is the code used to print a grid. All you can do then is make your own grid print routines in php using tcpdf

Change the permission for the file wkhtmltopdf-amd64 to be able to execute by www-data user (on ubuntu). Normally it is rw. Execute the command “chmod u+x wkhtmltopdf-amd64”

Hello Everyone:

I have my own server and the latest version 9.10.10(73) the latest Ubuntu 20.04.04. I having the same issue. I try in php.ini the disable_functions= but is not working. Please someone know how to fix it?

Thanksâ˜ș

Jose