Abobe Reader print with php

46 Views Asked by At

I'm having the following problem if anyone can help me I'd appreciate it. Sorry my english is not so good.

when I run this command with cmd it works perfectly

"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /t "C:\xampp\htdocs\Sistema\Logistica\comum\EtiquetasPDF\1076-29367.pdf" "impnova"

but when I run this command with php it doesn't work. I'm trying this way !

$imp = 'impnova';
$arq = "EtiquetasPDF\\$programa-$amostra.pdf";
$comand    = "\"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Acrobat.exe\" /t \"$arq\" \"$imp\"";
system($comand);            
        
echo $comand;

Does anybody know how to solve this ?

I tried to use php system() but it's not working. I expected system() to execute the command to print the pdf.

1

There are 1 best solutions below

3
KIKO Software On

When I run your code I get:

"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /t "EtiquetasPDF\1076-29367.pdf" "impnova"

Which is different from your original:

"C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" /t "C:\xampp\htdocs\Sistema\Logistica\comum\EtiquetasPDF\1076-29367.pdf" "impnova"

To get the same as the original your code should look like this:

$imp = 'impnova';
$arq = "C:\\xampp\\htdocs\\Sistema\\Logistica\\comum\\EtiquetasPDF\\$programa-$amostra.pdf";
$comand = "\"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Acrobat.exe\" /t \"$arq\" \"$imp\"";

This is no garantee that it will work, but at least it is now the same.