Page 1 of 2

Massive PDF's file printing

Posted: Fri Sep 10, 2010 11:00 am
by mikosiko
Hi,

Apache/PHP under Windows XP

I've been reading/searching a lot (maybe not enough) and I cannot find a method to do this... therefore I need some help if possible.

I have an application (php) that generate several PDF's files.. I can individually open and print them without problem but I've trying to implement something that allows to print all of them massively .. have the name/location of the files therefore I can loop through them and call "something" to print each one... I have tried using backticks, exec, shell_exec like in this simple example :

Code: Select all

<?php

 $file = "MYSQL-explain-diagram.pdf";

 $printcmd = `PDFXCVIEW.exe /print $file`;

 echo "<pre>$printcmd</pre>";

?>


the location for PDFXCVIEW.exe (my pdf viewer) is in the PATH and the file to print do exist... but no luck.. tried also calling a .bat without luck either

the questions are... is even possible to implement this?.. if so... could somebody give me some pointer where/what to look ? or.. how do you guys solve this scenario?

thank you

Re: Massive PDF's file printing

Posted: Sun Sep 12, 2010 10:00 pm
by JakeJ
If you just want to print them all at once and don't really need to automate it per se, just select all of the files in the folder you want to print, right click, and then click Print. Done.

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 2:21 am
by VladSun
First try using absolute paths for the command itself and the files passed as arguments.
Second, catch the error messages returned:

Code: Select all

 $result = system("/fullpathtoEXE/PDFXCVIEW.exe /print /fullpathtoFile/$file 2>&1");
echo $result;

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 3:33 pm
by mikosiko
JakeJ wrote:If you just want to print them all at once and don't really need to automate it per se, just select all of the files in the folder you want to print, right click, and then click Print. Done.
Thanks Jake... but I'm talking about an application here. tanks anyway

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 3:55 pm
by mikosiko
VladSun wrote:First try using absolute paths for the command itself and the files passed as arguments.
Second, catch the error messages returned:

Code: Select all

 $result = system("/fullpathtoEXE/PDFXCVIEW.exe /print /fullpathtoFile/$file 2>&1");
echo $result;
I did that too VladSun... I've tried a lot of things... nothing seems to work...

BTW: My server is a W2003 with Apache/Mysql/PHP

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 4:01 pm
by VladSun
mikosiko wrote:
VladSun wrote:First try using absolute paths for the command itself and the files passed as arguments.
Second, catch the error messages returned:

Code: Select all

 $result = system("/fullpathtoEXE/PDFXCVIEW.exe /print /fullpathtoFile/$file 2>&1");
echo $result;
I did that too VladSun... I've tried a lot of things... nothing seems to work...
What was the output?
mikosiko wrote:BTW: My server is a W2003 with Apache/Mysql/PHP
Well... look at my signature :twisted:

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 4:12 pm
by angelicodin
After looking over this, perhaps I'm still too new to php, but why not make a loop?

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 6:37 pm
by mikosiko
VladSun wrote: What was the output?
mikosiko wrote:BTW: My server is a W2003 with Apache/Mysql/PHP
Well... look at my signature :twisted:
output... nothing.. zero, zilch, null.... "absolute silence"... I'm perplex

about the signature... :twisted: I know...I know... but no option this time :roll:

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 6:39 pm
by mikosiko
angelicodin wrote:After looking over this, perhaps I'm still too new to php, but why not make a loop?
seems that you missed the point in my first post... but thanks anyway

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 7:54 pm
by buckit
Have you tried the EXEC() command? http://php.net/manual/en/function.exec.php

seems that would be better than system when looping as system will sit and wait for the process to finish before doing anything else. (have never attempted this and have little experience with system or exec. just throwing that out there)

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 8:27 pm
by mikosiko
Yes buckit... I mentioned that in my first post... thanks for trying to help

Re: Massive PDF's file printing

Posted: Mon Sep 13, 2010 10:32 pm
by Jonah Bron
What happens when you just run it right from the terminal?

Re: Massive PDF's file printing

Posted: Tue Sep 14, 2010 7:30 am
by buckit
Maybe try avoiding using a GUI viewer with switches and use a strictly command line printer like verypdf. http://www.verypdf.com/pdfprint/pdf-print-cmd.html

granted its $199. but trying the eval version can let you know if maybe its your current viewer thats causing the issue.

Re: Massive PDF's file printing

Posted: Tue Sep 14, 2010 10:00 am
by mikosiko
Jonah Bron wrote:What happens when you just run it right from the terminal?
if you mean the command than I'm using it print the file perfectly (silent No GUI)... same if I use AcroRead32 or NitroPdf or any other pdf viewer

Re: Massive PDF's file printing

Posted: Tue Sep 14, 2010 10:00 am
by mikosiko
buckit wrote:Maybe try avoiding using a GUI viewer with switches and use a strictly command line printer like verypdf. http://www.verypdf.com/pdfprint/pdf-print-cmd.html

granted its $199. but trying the eval version can let you know if maybe its your current viewer thats causing the issue.
done that too :)