ARTICLE AD BOX
I am trying to embed a signature from dscf7 signature to a pdf using tcpdf plugin, dscf7 is a wordpress plugin for contact form 7 where if a user signs the signature gets stored in wp-content/uploads/dscf7_signatures, and the file is a .png format. When I am in a local environment the signature displays on my pdf when generated using tcpdf using the below code, but shows only on desktop, but on mobile when the form gets submitted in a local environment it doesn't show, I used local link to test it on my mobile.
I have tried to host on a live server but still now the signature doesn't appear on the pdf at all. I have tried every possible way and still nothing here is my function to embed the signature to a pdf using tcpdf. Please help me if you can.
// Signature EMBED with dynamic size $signature_field_name = 'signature-701'; if (!empty($data[$signature_field_name])) { $dscf7_upload_dir = WP_CONTENT_DIR . '/uploads/dscf7_signatures'; $files = glob($dscf7_upload_dir . '/*.png'); if ($files) { usort($files, fn($a, $b) => filemtime($b) - filemtime($a)); $signature_file = $files[0]; // Get image size $img_size = getimagesize($signature_file); $img_width = $img_size[0]; $img_height = $img_size[1]; $max_width = 80; $max_height = 40; // Keep aspect ratio $ratio = min($max_width / $img_width, $max_height / $img_height); $pdf_width = $img_width * $ratio; $pdf_height = $img_height * $ratio; $pdf->Ln(10); $pdf->Image($signature_file, '', '', $pdf_width, $pdf_height, 'PNG'); // <-- fixed } }2
Explore related questions
See similar questions with these tags.
