Massive PDF's file printing

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Massive PDF's file printing

Post by Jonah Bron »

mikosiko wrote:
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
I don't quite understand. You're saying it prints properly if you type that command right into the terminal?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Massive PDF's file printing

Post by VladSun »

Sounds like permission issues ...
There are 10 types of people in this world, those who understand binary and those who don't
buckit
Forum Contributor
Posts: 169
Joined: Fri Jan 01, 2010 10:21 am

Re: Massive PDF's file printing

Post by buckit »

VladSun wrote:Sounds like permission issues ...
was just going to say that. bet the user for the apache process doesn't have the same permissions as the exe. now this is a much more common thing to happen in linux than windows so could easily not be that. but its worth a look.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Massive PDF's file printing

Post by mikosiko »

Jonah Bron wrote: ...
I don't quite understand. You're saying it prints properly if you type that command right into the terminal?
Yes
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Massive PDF's file printing

Post by mikosiko »

VladSun wrote:Sounds like permission issues ...
In windows? ... any kind that you are aware of? (I'm working with and account with administrative privileges)
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Massive PDF's file printing

Post by Weirdan »

mikosiko wrote:(I'm working with and account with administrative privileges)
But apache, most likely, works under different account like NETWORK SERVICE. You can check what account is used by the program via task manager.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Massive PDF's file printing

Post by mikosiko »

Weirdan wrote: But apache, most likely, works under different account like NETWORK SERVICE. You can check what account is used by the program via task manager.
I did check that too Weirdan... Apache is running as a windows service with "Logon As"=Local System... in task manager the httpd process shows as running under the "SYSTEM" username.

I'm lacking of more ideas at this point... maybe is time to just look for a different solution :roll:
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Massive PDF's file printing

Post by JakeJ »

Here's an idea to try to nail down where the problem is coming from...

Try executing a different windows process with the same code. For example, rather than printing, try opening the calculator or something. If it works, then you don't have a permissions issue, you have a printing issue.

But just for kicks, try giving the apache service administrator rights. Just don't leave it like that.

what if you created a batch file that would execute if from the command prompt and then use exec() to execute the batch file? It's a bit kludgy but it might work.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

[SOLVED] Massive PDF's file printing

Post by mikosiko »

thank you for the suggestions Jake... I had tried all of them already... same results every time.. I'm definitely inclined to the permits issue too but I'm failing to detect where and how to solve it. :banghead: ... I'm just calling the week off in this one :) maybe a good week end rest, plus a couple rounds of golf hitting that little freaking ball will give me some new ideas :)

EDIT SOLVED: Well seems that thinking in the week-end golf round made the trick!! :lol: I found the solution... was not a permit issue after all (but definitely is something to have in mind)... what is was that when exec() (or shell_exec or backtick) was executing the PDFXchange.exe it was not recognizing the default printer as existent, therefore the solutions was to write this line:

Code: Select all

$printcmd = `PDFXCHANGE.exe /print $file`;
in this way:

Code: Select all

$printer = "thename of the printer here";  
$printcmd = `PDFXCHANGE.exe /print:printer=\"$printer\" $file`;
Note: I did test with a local printer and also with a network printer (using FQN), both work perfectly.

Thanks everyone's suggestions... they definitely helped... specially the one mentioning "printing issue" :)
Post Reply