global $pdf;
/**
 * Set the PDF file that you want to overlay data onto 
 * Remember: the PDF needs to be version Acrobat 4.0 (PDF v1.3). See Readme.txt for details on converting. 
 */
//$pdf_name = PDF_TEMPLATE_LOCATION . 'pdfs/PDS-ABP.pdf';
$pdf_name = PDF_TEMPLATE_LOCATION . 'pdfs/trustee-declaration.pdf';
//$pdf_name = PDF_TEMPLATE_LOCATION . 'pdfs/Jesus-Erwin-Suarez-PHP-developer.pdf';
/*
 * Load the $pdf object using the PDF provided and return the $pdf_template_size array
 * which contains the size of each page of the PDF document.
 * This allows us to set a custom size for each PDF page using this information
 *
 * return array('load' => $pdf_load, 'size' => $pdf_template_size);
 */
$template = gfpdfe_business_plus::initilise($pdf_name);
/* 
 * Loop through the entry IDs
 * Generally this is just one entry, but multiple entries can be processed by passing along addition IDs through the URL
 * eg. &lid=12,14,18,20 
 */
foreach ($lead_ids as $lead_id) {
    /*
     * Get our standard entry information
     */
    $lead = RGFormsModel::get_lead($lead_id);
    /*
     * $form_data contains formated $lead data.
     * It contains all the records for the Gravity Form Entry
     * Use it to access the data you require.
     * You can review details for accessing your $form_data here: 
示例#2
0
文件: plus.php 项目: quinntron/tmad
 public static function setup($form_id, $lead_id, $template, $id, $output, $filename, $arguments)
 {
     global $lead_ids, $pdf;
     /*
      * If we aren't calling a premium template then exit early
      */
     if ($arguments['premium'] === false) {
         return false;
     }
     /*
      * Store our variables for later use
      */
     self::$form_id = $form_id;
     self::$lead_id = $lead_id;
     self::$template = $template;
     self::$output = $output;
     /*
      * Include the required files to process
      */
     /* 
      * DOMPDF replaced with mPDF in v3.0.0 
      */
     if (!class_exists('mPDF')) {
         include PDF_PLUGIN_DIR . 'mPDF/mpdf.php';
     }
     /* 
      * Include our template file now
      */
     include PDF_TEMPLATE_LOCATION . self::$template;
     /*
      * Display PDF is full-page mode which allows the entire PDF page to be viewed
      * Normally PDF is zoomed right in.
      */
     $pdf->SetDisplayMode('fullpage');
     /*
      * Automatically detect fonts and substitue as needed
      */
     $pdf->SetAutoFont(AUTOFONT_ALL);
     $pdf->useSubstitutions = true;
     /*
      * Set Creator Meta Data
      */
     $pdf->SetCreator('Gravity PDF v' . PDF_EXTENDED_VERSION . '. https://gravitypdf.com');
     /*
      * Set PDF DPI if added to configuration node
      */
     if ($arguments['dpi'] !== false) {
         /* TEXT DPI dramatically decreases the text size. As text is a vector element of the document we will only be concerned with the image DPI for the moment */
         /*$mpdf->dpi     = $arguments['dpi'];*/
         $mpdf->img_dpi = $arguments['dpi'];
     }
     /*
      * Set RTL languages at user request
      */
     if ($arguments['rtl'] === true) {
         $pdf->SetDirectionality('rtl');
     }
     /*
      * Set up security if user requested
      */
     if ($arguments['security'] === true && $arguments['pdfa1b'] === false && $arguments['pdfx1a'] === false) {
         $password = strlen($arguments['pdf_password']) > 0 ? $arguments['pdf_password'] : '';
         $master_password = strlen($arguments['pdf_password']) > 0 ? $arguments['pdf_password'] : null;
         $pdf_privileges = is_array($arguments['pdf_privileges']) ? $arguments['pdf_privileges'] : array();
         $pdf->SetProtection($pdf_privileges, $password, $master_password, 128);
     }
     /* PDF/A1-b support added in v3.4.0 */
     if ($arguments['pdfa1b'] === true) {
         $pdf->PDFA = true;
         $pdf->PDFAauto = true;
     } else {
         if ($arguments['pdfx1a'] === true) {
             $pdf->PDFX = true;
             $pdf->PDFXauto = true;
         }
     }
     /*
      * Run our output
      */
     $render = new PDFRender();
     switch ($output) {
         case 'download':
             $pdf->Output($filename, 'D');
             exit;
             break;
         case 'view':
             $pdf->Output($filename, 'I');
             exit;
             break;
         case 'save':
             /*
              * PDF wasn't writing to file with the F method - http://mpdf1.com/manual/index.php?tid=125
              * Return as a string and write to file manually
              */
             $pdf_output = $pdf->Output('', 'S');
             /*
              * Add a filter which lets us return the file path so we can attach it to notifications
              */
             add_filter('gfpdfe_return_pdf_path', array('gfpdfe_business_plus', 'return_path'), 10, 2);
             /*
              * Save the PDF and save the path
              */
             self::$path = $render->savePDF($pdf_output, $filename, $id);
             /*
              * Allow users to run a function after the PDF is saved
              */
             do_action('gfpdf_post_pdf_save', $form_id, $lead_id, $arguments, self::$path);
             break;
     }
     return true;
 }