/** * Different Pdf size Array for select box * * Handle to get Different Pdf size Array for select box * * @package WooCommerce - PDF Vouchers * @since */ function woo_vou_get_pdf_sizes_select() { $sizes = woo_vou_get_pdf_sizes(); $size_select_data = array(); if (!empty($sizes)) { //if size is not empty foreach ($sizes as $size => $values) { $size_select_data[$size] = $size; } } return apply_filters('woo_vou_get_pdf_sizes_select', $size_select_data); }
public function Header() { global $woo_vou_model, $woo_vou_template_id; //model class $model = $woo_vou_model; $prefix = WOO_VOU_META_PREFIX; $vou_template_bg_style = get_post_meta($woo_vou_template_id, $prefix . 'pdf_bg_style', true); $vou_template_bg_pattern = get_post_meta($woo_vou_template_id, $prefix . 'pdf_bg_pattern', true); $vou_template_bg_img = get_post_meta($woo_vou_template_id, $prefix . 'pdf_bg_img', true); $vou_template_bg_color = get_post_meta($woo_vou_template_id, $prefix . 'pdf_bg_color', true); $vou_template_pdf_view = get_post_meta($woo_vou_template_id, $prefix . 'pdf_view', true); //Get pdf size meta $woo_vou_template_size = get_post_meta($woo_vou_template_id, $prefix . 'pdf_size', true); $woo_vou_template_size = !empty($woo_vou_template_size) ? $woo_vou_template_size : 'A4'; //Get size array $woo_vou_allsize_array = woo_vou_get_pdf_sizes(); $woo_vou_size_array = $woo_vou_allsize_array[$woo_vou_template_size]; $pdf_width = isset($woo_vou_size_array['width']) ? $woo_vou_size_array['width'] : '210'; $pdf_height = isset($woo_vou_size_array['height']) ? $woo_vou_size_array['height'] : '297'; $font_size = isset($woo_vou_size_array['fontsize']) ? $woo_vou_size_array['fontsize'] : '12'; //Voucher PDF Background Color if (!empty($vou_template_bg_color)) { if ($vou_template_pdf_view == 'land') { // Check PDF View option is landscape // Background color $this->Rect(0, 0, $pdf_height, $pdf_width, 'F', '', $fill_color = $model->woo_vou_hex_2_rgb($vou_template_bg_color)); } else { // Background color $this->Rect(0, 0, $pdf_width, $pdf_height, 'F', '', $fill_color = $model->woo_vou_hex_2_rgb($vou_template_bg_color)); } } //Voucher PDF Background style is image & image is not empty if (!empty($vou_template_bg_style) && $vou_template_bg_style == 'image' && isset($vou_template_bg_img['src']) && !empty($vou_template_bg_img['src'])) { $img_file = $vou_template_bg_img['src']; } else { if (!empty($vou_template_bg_style) && $vou_template_bg_style == 'pattern' && !empty($vou_template_bg_pattern)) { //Voucher PDF Background style is pattern & Background Pattern is not selected if ($vou_template_pdf_view == 'land') { // Check PDF View option is landscape // Background Pattern Image $img_file = WOO_VOU_IMG_URL . '/patterns/' . $vou_template_bg_pattern . '.png'; } else { // Background Pattern Image $img_file = WOO_VOU_IMG_URL . '/patterns/port_' . $vou_template_bg_pattern . '.png'; } } } if (!empty($img_file)) { //Check image file // get the current page break margin $bMargin = $this->getBreakMargin(); // get current auto-page-break mode $auto_page_break = $this->AutoPageBreak; // disable auto-page-break $this->SetAutoPageBreak(false, 0); if ($vou_template_pdf_view == 'land') { // Check PDF View option is landscape // Background image $this->Image($img_file, 0, 0, $pdf_height, $pdf_width, '', '', '', false, 300, '', false, false, 0); } else { // Background image $this->Image($img_file, 0, 0, $pdf_width, $pdf_height, '', '', '', false, 300, '', false, false, 0); } // restore auto-page-break status $this->SetAutoPageBreak($auto_page_break, $bMargin); // set the starting point for the page content $this->setPageMark(); } }