dealfonso / sapp

Simple and Agnostic PDF Document Parser in PHP - sign PDF docs using PHP
GNU Lesser General Public License v3.0
115 stars 30 forks source link

Undefined constant "ddn\\sapp\\helpers\\STDERR\" when running outside CLI #18

Closed iMusicJJ closed 1 year ago

iMusicJJ commented 2 years ago

This happens when the script is run as part of a PHP-program, and not as a CLI script.

The particular instance that I am running into is at PDFDoc:755

p_debug("generating xref using classic xref...trailer");

raimon-segura commented 2 years ago

Hi!,

I could workaround this adding if(!defined('STDERR')) define('STDERR', fopen('php://stderr', 'wb')); just before the PDFDoc::from_string call, hope this helps!

dealfonso commented 1 year ago

Hi,

commit f1c548c213ebfe8eef5295e15390018aeec77cbb solves this issue.

Thank you @raimon-segura for the hint.

@iMusicJJ could you please check it?

raimon-segura commented 1 year ago

@dealfonso thanks to you for your great work with this project! ...best solution to sign pdf :D