private function generate_pdf_parameters($index, $form_id, $lead_id, $template = '')
 {
     $pdf_name = isset($this->configuration[$index]['filename']) && strlen($this->configuration[$index]['filename']) > 0 ? FPPDF_Common::validate_pdf_name($this->configuration[$index]['filename'], $form_id, $lead_id) : FPPDF_Common::get_pdf_filename($form_id, $lead_id);
     $template = isset($template) && strlen($template) > 0 ? $template : $this->get_template($index);
     $pdf_size = isset($this->configuration[$index]['pdf_size']) && (is_array($this->configuration[$index]['pdf_size']) || strlen($this->configuration[$index]['pdf_size']) > 0) ? $this->configuration[$index]['pdf_size'] : self::$default['pdf_size'];
     $orientation = isset($this->configuration[$index]['orientation']) && strlen($this->configuration[$index]['orientation']) > 0 ? $this->configuration[$index]['orientation'] : self::$default['orientation'];
     $security = isset($this->configuration[$index]['security']) && $this->configuration[$index]['security'] ? $this->configuration[$index]['security'] : self::$default['security'];
     $premium = isset($this->configuration[$index]['premium']) && $this->configuration[$index]['premium'] === true ? true : false;
     /*
      * Validate privileges
      * If blank and security is true then set privileges to all
      */
     $privileges = isset($this->configuration[$index]['pdf_privileges']) ? $this->validate_privileges($this->configuration[$index]['pdf_privileges']) : $this->validate_privileges('');
     $pdf_password = isset($this->configuration[$index]['pdf_password']) ? FPPDF_Common::do_mergetags($this->configuration[$index]['pdf_password'], $form_id, $lead_id) : '';
     $master_password = isset($this->configuration[$index]['pdf_master_password']) ? FPPDF_Common::do_mergetags($this->configuration[$index]['pdf_master_password'], $form_id, $lead_id) : '';
     $rtl = isset($this->configuration[$index]['rtl']) ? $this->configuration[$index]['rtl'] : false;
     /* added in v3.4.0 */
     $pdfa1b = isset($this->configuration[$index]['pdfa1b']) && $this->configuration[$index]['pdfa1b'] === true ? true : false;
     /* added in v3.4.0 */
     $pdfx1a = isset($this->configuration[$index]['pdfx1a']) && $this->configuration[$index]['pdfx1a'] === true ? true : false;
     /*
      * Run the options through filters
      */
     $pdf_name = apply_filters('fppdf_pdf_name', $pdf_name, $form_id, $lead_id);
     $template = apply_filters('fppdf_template', $template, $form_id, $lead_id);
     $orientation = apply_filters('fppdf_orientation', $orientation, $form_id, $lead_id);
     $security = apply_filters('fppdf_security', $security, $form_id, $lead_id);
     $privileges = apply_filters('fppdf_privilages', $privileges, $form_id, $lead_id);
     $pdf_password = apply_filters('fppdf_password', $pdf_password, $form_id, $lead_id);
     $master_password = apply_filters('fppdf_master_password', $master_password, $form_id, $lead_id);
     $rtl = apply_filters('fppdf_rtl', $rtl, $form_id, $lead_id);
     $pdf_arguments = array('pdfname' => $pdf_name, 'template' => $template, 'pdf_size' => $pdf_size, 'orientation' => $orientation, 'security' => $security, 'pdf_password' => $pdf_password, 'pdf_privileges' => $privileges, 'pdf_master_password' => $master_password, 'rtl' => $rtl, 'premium' => $premium, 'pdfa1b' => $pdfa1b, 'pdfx1a' => $pdfx1a);
     return $pdf_arguments;
 }
 public function get_pdf_name($index, $form_id = false, $lead_id = false)
 {
     if (isset($this->configuration[$index]['filename'])) {
         return FPPDF_Common::validate_pdf_name($this->configuration[$index]['filename'], $form_id, $lead_id);
     } else {
         return FPPDF_Common::validate_pdf_name(FPPDF_Common::get_pdf_filename($form_id, $lead_id), $form_id, $lead_id);
     }
 }