Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:36:42+00:00 2026-05-30T09:36:42+00:00

I am trying to print generated forms / receipts through PHP (the printers will

  • 0

I am trying to print generated forms / receipts through PHP (the printers will be installed on the server, I am not attempting to print to a user’s local printer). I have decided to try the following methodology:

IN PHP:

  1. Generate a PDF file and save it on the server.
  2. Call a perl script to print said PDF file.

IN perl:

  1. Use system() to “open” Reader and print the given PDF silently.

What works:

  • I can generate PDFs in PHP.
  • I can call a perl script.
    • If the script has errors, they report to the browser window. ie: If I purposely change file paths it fails, and reports the appropriate reason.
  • functions such as printf seem to work fine as the output displays in the browser.
  • The exact same perl script (with the “non-functioning” line mentioned below) works properly when executed from the command line or the IDE.

What doesn’t work:

  • In perl: system('"C:\\Program Files (x86)\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe" /N /T "C:\\test.pdf" 0-XEROX');

What happens:

  • NOTHING! I get no errors. It just flat out refuses to open Adobe Reader. All code below this line seems to run fine. It’s like the function is being ignored. I am at a loss as to why, but I did try a few things.

What I’ve tried:

  • Changed permissions of the AcroRd32.exe to Everyone - Full Control.
  • Output the $? after the system() call. It is 1, but I don’t know what 1 means in this case.
  • Verified that there are no disable_functions listed in php (though I think this is unrelated as shell_exec seems to be working, since some of the perl code is ran).
  • Various other configurations that at least got me to the point where I can confirm that PHP is in fact calling the perl script, it just isn’t running the system() call.

Other info:

  • Apache 2.2.1.7
  • PHP 5.35
  • Perl 5.12.3 built for MSWin32-x86-multi-thread
  • WampServer 2.1

I’m at a loss here, and while it seems like this is an Apache / permissions problem, I cannot be sure. My experience with Apache is limited, and most of what I find online is linux commands that don’t work in my environment.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:36:43+00:00Added an answer on May 30, 2026 at 9:36 am

    Try this:

    my @args = ('C:/Program Files (x86)/Adobe/Reader 10.0/Reader/AcroRd32.exe');
    if (system(@args) != 0) {
        # Can't run acroread.  Oh Noes!!!
        die "Unable to launch acrobat reader!\n";
    }
    

    The thing about system() is that it does two different things
    depending on the number and type(s) of argument it gets. If the
    argument is an array or if there are multiple arguments, Perl assumes
    the first is the program to run with the rest as its arguments and it
    launches the program itself.

    If, however it’s just one string, Perl handles it differently. It
    runs your command-line interpreter (typically CMD.EXE on Windows) on
    the string and lets it do what it wants with it. This becomes
    problematic pretty quickly.

    Firstly, both Perl and the shell do various kinds of interpolation on
    the string (e.g. replace ‘//’ with ‘/’, tokenize by space, etc.) and
    it gets very easy to lose track of what does what. I’m not at all
    surprised that your command doesn’t work–there are just so many
    things that can go wrong.

    Secondly, it’s hard to know for sure what shell actually gets run on
    Windows or what changes Perl makes to it first. On Unix, it usually doesn’t matter–every shell does more or
    less the same with simple commands. But on Windows, you could be
    running raw CMD.EXE, GNU Bash or some intermediate program that
    provides Unix-shell-like behaviour. And since there are several
    different ports of Perl to Windows, it could well change if you
    switch.

    But if you use the array form, it all stays in Perl and nothing else
    happens under the hood.

    By the way, the documentation for system() and $? can be found here and here. It’s well worth reading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to print a PHP generated document in chrome, on the browser
Im trying to print the realtime output based on user input for a search.
I'm trying to use php with mysql. basically i've an index page where user
I have two forms and I am trying to capture an event generated from
Im trying print Excel file data on a page. To do it i used
I'm trying to print the output of function only when it is true but
I am trying to print a report that contains a bar graph using the
I am trying to print invoice. But top whatever i do to setting margins,
I am trying to print a portion of the page in FF3. This works
I am trying to print 1 if there are at least two of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.