Skip to content
Advertisement

Detect pdf landscpe with ssh pdfinfo

After researching to see how I can make PHP know the orientation of the pdf, and found a solution with pdfinfo, it works fine by bash. but I can’t get that by PHP with executing exec command, I receive the response under the string to be able to create an if rule. I do not understand why the if of the PHP does not work with the answer of the ssh.

JavaScript

Advertisement

Answer

There could be white space in the returned value. Use trim($test) before the if condition to trim the white space.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement