Closed raimon-segura closed 2 years ago
@dealfonso Any hint? ...maybe I can find the bug by myself, but not sure where to start :D
...thanks!
Hi,
I'll try to check it this week.
I have just inspected your docs... and if you dump them (e.g. using cat
), I can see some problems:
In doc _simple_pdfserversigned.pdf, after the document ends, I can see the next HTML code:
<pre>An Error occurred while handling another error:
yii\web\HeadersAlreadySentException: Headers already sent in /app/backend/controllers/StudentController.php on line 1028. in /app/vendor/yiisoft/yii2/web/Response.php:368
Stack trace:
#0 /app/vendor/yiisoft/yii2/web/Response.php(341): yii\web\Response->sendHeaders()
#1 /app/vendor/yiisoft/yii2/web/ErrorHandler.php(136): yii\web\Response->send()
#2 /app/vendor/yiisoft/yii2/base/ErrorHandler.php(135): yii\web\ErrorHandler->renderException(Object(yii\web\HeadersAlreadySentException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\HeadersAlreadySentException))
#4 {main}
Previous exception:
yii\web\HeadersAlreadySentException: Headers already sent in /app/backend/controllers/StudentController.php on line 1028. in /app/vendor/yiisoft/yii2/web/Response.php:368
Stack trace:
#0 /app/vendor/yiisoft/yii2/web/Response.php(341): yii\web\Response->sendHeaders()
#1 /app/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#2 /app/backend/web/index.php(68): yii\base\Application->run()
#3 {main}</pre>
In the middle of document _simple_pdf_not_serversignedterminalsigned.pdf, I see the next HTML code:
<pre>An Error occurred while handling another error:
yii\web\HeadersAlreadySentException: Headers already sent in /app/backend/controllers/StudentController.php on line 1028. in /app/vendor/yiisoft/yii2/web/Response.php:368
Stack trace:
#0 /app/vendor/yiisoft/yii2/web/Response.php(341): yii\web\Response->sendHeaders()
#1 /app/vendor/yiisoft/yii2/web/ErrorHandler.php(136): yii\web\Response->send()
#2 /app/vendor/yiisoft/yii2/base/ErrorHandler.php(135): yii\web\ErrorHandler->renderException(Object(yii\web\HeadersAlreadySentException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\HeadersAlreadySentException))
#4 {main}
Previous exception:
yii\web\HeadersAlreadySentException: Headers already sent in /app/backend/controllers/StudentController.php on line 1028. in /app/vendor/yiisoft/yii2/web/Response.php:368
Stack trace:
#0 /app/vendor/yiisoft/yii2/web/Response.php(341): yii\web\Response->sendHeaders()
#1 /app/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#2 /app/backend/web/index.php(68): yii\base\Application->run()
#3 {main}</pre>8 0 obj
This happens because the original doc contains that code, thus making the final doc invalid.
Doc _simple_pdf_rebuilded_and_serversigned_pdftkINVALIDSIGNED.pdf does not seem to have been signed at all.
Please check the docs and try again.
Hi Carlos!,
You are right! ...and the solution is very simple, it needs an "exit()" just after the "echo"
... header("Content-type:application/pdf"); header("Content-Disposition:attachment;filename=$pdf_filename"); echo $obj->to_pdf_file_s(true); exit();
Many thanks for your help!
Hi!,
I'm trying to sign a pdf generated with Mpdf php library:
The
set_signature_certificate
method increases the filesize but the file doesn't show any certificate, I've been checking with "libreOffice Draw". Also, I've tried to rebuild the pdf withsapp
before set signature and sign the pdf using terminalpdfsign.php
script without any luck.The only thing that works is to convert using
pdftk
after generate it withmpdf
, and then sign withpdfsign.php
script, but this is not a good workflow for me, ideally it should work only with php.I'm attaching several example pdf, hope this helps to find the issue:
simple_pdf_not_serversigned.pdf simple_pdf_not_serversigned_pdftk.pdf simple_pdf_not_serversigned_pdftk_terminalsigned_OKSIGNED.pdf simple_pdf_not_serversigned_terminalsigned.pdf simple_pdf_rebuilded_and_serversigned.pdf simple_pdf_rebuilded_and_serversigned_pdftk_INVALIDSIGNED.pdf simple_pdf_serversigned.pdf simple_pdf_serversigned_pdftk_INVALIDSIGNED.pdf
Many Thanks!