I just encountered this "problem" and solved it for me. Maybe it is also useful for others.
Printing of PDFs can be automatically started via javascript.
Please note that JavaScript in PDF is much different from Javascript in HTML. The first is executed by (usually) Acrobat while second uses the API of the Webbrowser.
One condition is that the user has not disabled Javascript in Acrobat.
There's a little addon which allows to add Javascript in PDFs when using FPDF:
http://www.fpdf.de/downloads/addons/36/
I downloaded the zip and placed fpdf_js.php in the FPDF subfolder of nubuilder.
Then I changed "run_report_pdf_v2.php": (make a backup copy of this file before altering)
After the line
I added this line:
I changed this line:
To:
Code: Select all
class nuPDF extends PDF_Javascript{
Then I added the following method (can be pasted above "function __construct ...")
Code: Select all
function AutoPrint($dialog=true)
{
$param=($dialog ? 'true' : 'false');
$script="print($param);";
$this->IncludeJS($script);
}
Finally I added the following line in the function "build_report" below "$pdf = new nuPDF(..."
This should Acrobat let show automatically the Print Dialog when any PDF is generated via nuBuilder.
To suppress the Print-Dialog pass "false" to the Autoprint function.
Maybe there's a more elegant way to implement this (without patching the source). I would be happy to read about this.