2
votes

I am using the WKHTMLTOPDF for converting html pages to pdf. I wrote the below code.

system("wkhtmltopdf http://localhost/advisory_system/frontend/index.php/Analysis/fpdf /opt/lampp/htdocs/pdf_testo/test1/pdf_final_testA_$i.pdf  2>&1");

While using the above script in my PHP script it outputs the STATUS, like:

Loading pages (1/6) [> ] 0% [======> ] 10% [=========> ] 15% [==========> ] 18% [============> ] 21% [=================> ] 29% [========================> ] 41% [==========================> ] 44% [==============================> ] 50% [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [=====> ] Page 1 of 11 [==========> ] Page 2 of 11 [================> ] Page 3 of 11 [=====================> ] Page 4 of 11 [===========================> ] Page 5 of 11 [================================> ] Page 6 of 11 [=====================================> ] Page 7 of 11 [===========================================> ] Page 8 of 11` [================================================> ] Page 9 of 11 [======================================================> ] Page 10 of 11 [============================================================] Page 11 of 11 Done

How can I prevent output of this type of status by wkhtmltopdf?

Version is: 0.12.1 (with patched qt)

2
Isn't there a --help mode mentioning the quiet flag? And you're just mapping stderr to stdout, but don't redirect the latter to null. - mario
@mario I don't have found any --help there and can you tell me how can i later redirects it to null. - Harshal Mahajan

2 Answers

1
votes

Finally I got the Solution, By Using the exec function of PHP.It Just execute the command and don't send the out put while system function outputs the execution output. So my script looks like now :

exec("wkhtmltopdf http://localhost/advisory_system/frontend/index.php/Analysis/fpdf /opt/lampp/htdocs/pdf_testo/test1/pdf_final_testA_$i.pdf  2>&1");
0
votes

You can stop wkhtmltopdf from outputting the status by setting the default configurations and verbose configurations as follows:

config.default_options = {
 :quiet => true,
 :debug_javascript => false
}
config.verbose = false