Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert multiple signatures with image in PDF with higher version v1.4 #92

Open
michael-guemo opened this issue Feb 14, 2025 · 0 comments

Comments

@michael-guemo
Copy link

michael-guemo commented Feb 14, 2025

I am trying to sign a PDF multiple times with a digital signature and image. In version v1.4 it signs and preserves the images in all the parts where it was placed, but in higher versions v.1.7 it preserves all the signatures and only the last one added with an image.

$obj->set_signature_appearance($page, [$x, $y, $x + $width, $y + $height], $image);

if (!$obj->sign_document($p12File, $password, $page, $image, $x, $y, [120, 40])) {
$arrResponse = array('status' => false, 'msg' => 'El certificado no es valido');
echo json_encode($arrResponse, JSON_UNESCAPED_UNICODE);
die();
} else {
$docsigned = $obj->to_pdf_file_s();

if ($docsigned === false) {
    $arrResponse = array('status' => false, 'msg' => 'No se pudo firmar el documento');
    echo json_encode($arrResponse, JSON_UNESCAPED_UNICODE);
    die();
} else {

    $filePathTemp = 'assets/pdf/demo.pdf';
    if (!file_exists($folderPathTemp)) {
        mkdir($folderPathTemp, 0777, true);
    }

    if (file_put_contents($filePathTemp, $docsigned) !== false) {
        $file_content = file_get_contents($filePathTemp);
        $obj = PDFDoc::from_string($file_content);
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant