Reputation: 49
my problem is that i cannot move to the last statement that is the echo statement. the pdf signer gives a correct output but the execution stops at the line '$signer->sign($module);'
how can i move to the next statement that is the echo statement
my code is given below...
require_once('SetaPDF-Signer/library/SetaPDF/Autoload.php');
// configure the temporary writer
SetaPDF_Core_Writer_TempFile::setTempDir('SetaPDF-Signer/demos');
// create a writer
$writer = new SetaPDF_Core_Writer_Http('235.pdf', true);
// create a new document instance
$document = SetaPDF_Core_Document::loadByFilename(
'SetaPDF-Signer/235.pdf', $writer
);
// create a signer instance
$signer = new SetaPDF_Signer($document);
// set some signature properties
$signer->setReason('needs to provide this ');
$signer->setLocation('needs to provide this');
// create a signature module
$module = new SetaPDF_Signer_Signature_Module_OpenSsl();
// load the certificate
$certificate = file_get_contents('xxxxxxxxx.pem');
$module->setCertificate($certificate);
$module->setPrivateKey(array($certificate, 'xxxxxxxxxx' /* no password */));
// sign the document and send the final document to the initial writer
$signer->sign($module);
echo "welcome";
Upvotes: 1
Views: 1857
Reputation: 5058
You have to choose another writer instance, that will not automatically send the resulting document to the clients browser. E.g.:
$writer = new SetaPDF_Core_Writer_File('path/to/235.pdf');
instead of
$writer = new SetaPDF_Core_Writer_Http('235.pdf', true);
An overview of all available writer classes in SetaPDF is available here.
Upvotes: 1