I have been trying to get a button in a Zend form to trigger a custom Library class that builds a PDF (extending Zend_pdf) when a user clicks on a specific button in a form.
For some reason when it adds a new PdfBuilder(); it does not fail, nor does it trigger any error_logging despite asking it.
I believe I may have missed a link somewhere in this process and any help would be greatly appreciated.
I am trying to get it to view in a new window instead of saving it as it is up to the user if they want it.
I think you may be mixing server-side and client-side functionality here. The 'Zend form button' cannot trigger server-side code directly as a 'onclick' event.
You need to create a Zend Form (or regular form) that contains a submit button. This will post the request back to the controller action where you can instantiate the construction of the PDF. For example:
Form markup (/make-pdf):
<form method="post" action="/make-pdf">
<input type="submit" name="makePdf" value="submit me" />
</form>
In your controller:
public function makePdfAction()
{
if ($this->getRequest()->isPost()) {
// Trigger the PDF build here.
}
}