Jump to content

New PDF templates in Module?


greyfinality

Recommended Posts

Hi everyone, I'm a new prestashop developer, and after a lot of looking around the forums and googling I can't seem to find any resources on how to generate a pdf other from a template within the module. When I try to simply generate the pdf by putting the direct link in the template field, I don't generate anything. Can anyone tell me what I need to fix so I can get a pdf that says "hello world" to generate from this process?

public function processGeneratePdf(){
	if(Tools::isSubmit("id_order"))
	    $order=new Order(Tools::getValue("id_order"));
	if(!Validate::isLoadedObject($order))
	     $this->errors[] = Tools::displayError('Order not found in DB');
	$helloTemplate=_PS_MODULE_DIR_.'module/pdf/helloWorld.tpl';
	$pdf=new PDF($order,$helloTemplate,$this->context->smarty);
	$pdf->render();
		}

When I do the same thing with, PDF::TEMPLATE_INVOICE, it works fine, but I want to be able to generate my own PDF forms manually. What am I missing?

Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...