/** * Renders the signature area for the certificate. */ function render_handleSignature() { // Have we got a text or image signature? $signature = ''; $signatureType = WPCW_arrays_getValue($this->settingsList, 'cert_signature_type', 'text'); $signatureImg = WPCW_arrays_getValue($this->settingsList, 'cert_sig_image_url'); // Get the text for the signature if ('text' == $signatureType) { $signature = WPCW_arrays_getValue($this->settingsList, 'cert_sig_text'); // Nothing to do, signature is empty if (!$signature) { return; } // Create the signature $signature_len = $this->pdffile->GetStringWidth($signature); $this->pdffile->SetXY($this->signature_X + ($this->footer_line_length - $signature_len) / 2, $this->footer_Y); $this->pdffile->Cell(0, 0, $signature, false, false); } else { // No image to work with if (!$signatureImg) { return; } // Image is fetched using URL, and resized to match the space. We're using // an image that's twice the size to get it to scale nicely. $sigWidth = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX); $sigHeight = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX); $this->pdffile->Image($signatureImg, $this->signature_X + ($this->footer_line_length - $sigWidth) / 2, $this->footer_Y - $sigHeight + 3, $sigWidth); // Only force width } }
/** * Renders the signature area for the certificate. */ function render_handleSignature() { $topLineY = 257; // Have we got a text or image signature? $signature = ''; $signatureType = WPCW_arrays_getValue($this->settingsList, 'cert_signature_type', 'text'); $signatureImg = WPCW_arrays_getValue($this->settingsList, 'cert_sig_image_url'); // Get the text for the signature if ('text' == $signatureType) { // Use codepage translation of signature text $encoding = WPCW_arrays_getValue($this->settingsList, 'certificate_encoding', 'ISO-8859-1'); $signature = iconv('UTF-8', $encoding . '//TRANSLIT//IGNORE', WPCW_arrays_getValue($this->settingsList, 'cert_sig_text')); // Nothing to do, signature is empty if (!$signature) { return; } // Create the signature $signature_len = $this->pdffile->GetStringWidth($signature); $this->pdffile->SetXY($this->signature_X + ($this->footer_line_length - $signature_len) / 2, $topLineY); $this->pdffile->Cell(300, 150, $signature, false, false); } else { // No image to work with if (!$signatureImg) { return; } // Image is fetched using URL, and resized to match the space. We're using // an image that's twice the size to get it to scale nicely. $sigWidth = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_WIDTH_PX); $sigHeight = WPCW_Certificate::px2mm(WPCW_CERTIFICATE_SIGNATURE_HEIGHT_PX); // Only force width $this->pdffile->Image($signatureImg, 122, 252, $sigWidth); } }